English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

like this view:
1
121
12321
1234321
123454321

2007-03-27 23:49:12 · 6 answers · asked by hothaifeh e 1 in Computers & Internet Programming & Design

6 answers

cout << "1" < cout << "121" <
.
.
.

2007-03-28 00:40:20 · answer #1 · answered by Anonymous · 0 1

Hi,
Nice to see someone discussin somethin about programs...
Here's ur code :-

(I assume u r workin on Windows platform...)

#include
#include
void main()
{
     int i, j, n = 5;
     clrscr();

     for(i=1; i<=n; i++)
      {
         for(j=1; j<=i; j++)
          {
              cout <<" "<           }

         j -= 2;
         for(; j>=1; j--)
          {
              cout <<" "<           }

         cout << "\n" ;
      }
     getch();
}


I hope that u find the logic pretty clear n easy to trace....

Thanks,
Dhruv

2007-03-28 00:21:40 · answer #2 · answered by Dhruv Saxena 2 · 1 0

1
22
333
22
1

???

2014-10-14 10:50:23 · answer #3 · answered by Anonymous · 0 0

its just the sqr of numbers like 1, 11 , 111, 1111,111111

#include
#include

int main()
{
int i,x,y,prev;ans=1;
printf("%d/n",ans);
prev=1;
for(i=1;i<=10;i++) //set the i value to watever u want; i have set it to 10 here
{
y=10(pow)(i); //I dont know the way how C represents power function
x=y+prev;
ans=x*x;
prev=x;
printf("%d/n",ans);
}
getch();
return 0;
}

2007-03-28 00:02:47 · answer #4 · answered by Mozhi 1 · 0 0

for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= i; j++)
{
cout< }
for (int k = i-1; k > 0; k--)
{
cout< }
cout< }

2007-03-28 04:41:09 · answer #5 · answered by Me 4 · 0 0

int i, j, k, num = 5;
cout << "number u1=";


cin >> num;
for (i = 1; i <= num; i++)
{
for (j = 1; j <= num - i; j++)
{
cout << " ";
}
for (k = 1; k < i; k++)
{
cout << k;

}
for (k = i; k >= 1; k--)
{
cout << k;
}

cout << endl;
}

//----------------------------------------
for (i = num; i >= 1; i--)
{
for (j = 1; j <= num - i; j++)
{
cout << " ";
}
for (k = 1; k < i; k++)
{
cout << k;

}
for (k = i; k >= 1; k--)
{
cout << k;
}

cout << endl;
}
//www.heilton.com

2016-05-08 00:51:39 · answer #6 · answered by ? 1 · 0 0

fedest.com, questions and answers