Answer to Question #55531 in C for Ric Jumagdao
C not C++ Number patter pyramid dont include the parenthesis.Example enter a number n=4 the output is
***1
**21
*321
4321
1
2015-10-15T02:49:38-0400
#include <stdio.h>
using namespace std;
int main(int argc, char **argv)
{
int i,j, n;
printf("Input n: ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<n-i-1;j++)
printf(" ");
for(j=n-i-1;j<n;j++)
printf("%d",n-j);
printf("\n");
}
return 0;
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
C
Comments
Leave a comment