How To Print Number Pattern.
What will be the solution of number pattern for right angle triangle?
#include<stdio.h>
#include<conio.h>
int main()
{
int row, col,count,diff; //Data type deceleration
for(row=1;row<=5;row++) //For row
{
diff=5-1; //this is difference for number pattern
count=row; //count is equal to row
for(col=1;col<=row;col++) // for column
{
printf(" %d",count); //printing number pattern
count+=diff; //adding difference in count to print number pattern fro 2nd column and onward
diff--; // decreasing difference by 1.
}
printf("\n"); //for new line
}
getch();
return 0;
}
Output
Fig:-2
If you did not understand this code then go to my YouTube Video of this programming. And also comment in comment section so that I can help you.
It is very helpful ...
ReplyDeleteLots of best wishes 💐😍
best 1
ReplyDelete