how can i get output the following...
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1
and
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
plz plz...
Answers were Sorted based on User's Feedback
Answer / aditi
For first one:-
void main ()
{
for (int i= 5; i>= 1; i--)
{
for (int k=5; k >= 1; k--)
{
if (k> i)
printf(" ");
else
printf ("%d", k);
}
printf("\n");
}
}
For second:-
void main ()
{
int n = 0;
for (int i=1; i<6; i++)
{
for (int k=1; k <= i; k++)
{
n = n +1;
printf ("%d ", n);
}
printf("\n");
}
}
| Is This Answer Correct ? | 12 Yes | 1 No |
Answer / abhishek karnani
void main ()
{
int i,k,j;
clrscr();
for (i=0;i<5;i++)
{
for (j=5;j>=i+1;j--)
{
printf ("%d",j);
}
printf("\n");
for (k=0;k<j+1;k++)
{
printf(" ");
}
}
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / anas
for(i=n;i>=1;i--)
{
for(c=1;c<=n-i;c++)
{
cout<<" ";
}
for(k=i;k>=1;k--)
{
cout<<k;
}
cout<<"\n";
}
----------------------------------------------
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
//for second.
int n=1;
for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
{
cout<<n<<" ";
n++;
}
cout<<"\n";
}
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
How are variables declared in c?
main() { static int ivar=5; printf("%d",ivar--); if(ivar) main(); }
what is the return value (status code) of exit() function.... what the arguments(integer value) passed to it means....
What is the output of below code? main() { static in a=5; printf("%3d",a--); if(a) main(); }
What is abstract data structure in c?
Write a C program to print 1 2 3 ... 100 without using loops?
Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above
What is the meaning of this decleration? unsigned char (*pArray[10][10]); please reply.
What are the similarities between c and c++?
Q-1: Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college.
will u please send me the placement papers to my mail???????????????????
How to establish connection with oracle database software from c language?