Thursday , September 21 2017
Home / C / c program for pattern#12

c program for pattern#12



This pattern is also an easy one , where you have to indent each line accordingly. Here you can observe that the indentation is directly related to the numbers in each row. If no. of lines are n . then for ith row output is= (n-i)Blank spaces + (1 to i) numbers 
Also check: Alternate Java program for pattern#12

void main()
int i,j,n;        // variable I and j are the loop variables,n is the variable for the number of input rows.
printf("Enter the number of lines for pattern : ");
scanf("%d",&n);         // taking the input values form the user
for(i=1;i<=n;i++)         //loop for number of rows in pattern
for(j=1;j<=n-i;j++)        // loop for spaces
printf(" ");
for(j=1;j<=i;j++)        // loop for pattern to be print
printf("%d",j);    // printing the number for each iteration of loop.
printf("\n");      // for next line



Check Also

How to Solve Linear Equation in One Variable In C Programming?

C Program to Solve any Linear Equation in One Variable Find complete C program to ...

Leave a Reply

Your email address will not be published. Required fields are marked *