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 |
What is c language used for?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
int main() { int i=-1,j=-1;k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d%d%d%d%d",i,j,k,l,m); }
what is the use of fflush() function?
hi, which software companys will take,if d candidate's % is jst 55%?
Develop a program that computes the new price of an item. The program should receive a character variable colour and a double precision floating-point variable price from the user. Discount rate is determined based on the colour of the discount sticker, as shown in the following table. An error message should be printed if an invalid colour has been entered
write a c program to find reminder and quotient if one number is divided by other.to code this program don't use more than 2 variables
array contains zeros and ones as elements.we need to bring zeros one side and one other side in single parse. ex:a[]={0,0,1,0,1,1,0,0} o/p={0,0,0,0,0,1,1,1}
Write a program to print all the prime numbers with in the given range
8 Answers ABC, College School Exams Tests, TCS,
main() { static int ivar=5; printf("%d",ivar--); if(ivar) main(); }
why java is called as a purely oops language.
Explain following declaration int *P(void); and int (*p)(char *a);