1234567
12345
123
1
int main()
{
int i,j;
for(i=7;i>=1;i-=2)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
printf("\n");
}
return 0;
}
Related Links:
- More Number Pattern Programs
- Star Pattern Programs in C
- Alphabet Pattern Programs in C
- Series Programs in C
The above program is conceptually incorrect. It will run only for 7.
ReplyDeleteHere is a generic program that will run for any number of rows ->
void numberPatternC(int rows) {
int i;
int j;
int count = 1;
for(i=1; i<rows; i++) {
count = count + 2;
}
for(i=0; i<rows; i++) {
for(j=1; j<=count; j++) {
System.out.print(j);
}
System.out.println();
count = count - 2;
}
}
you can use variable to store any dynamic value and use that in loop
DeleteThat is not very kind to say it is incorrect. Surely the pattern starts at number 7 then decrease it by 2. It did not ask to write a program that will start at a particular number. Be very kind as to not
Deletecriticise someone. The program above works and it's beautiful.
#include
ReplyDelete#include
void main()
{
int i,j,n;
clrscr();
for(i=3;i>=0;i--)
{
n=2*i+1;
for(j=1;j<=n;j++)
{
printf("%d",j);
}
printf("\n");
}
getch();
}
//////////// sir, i think its simple :)
very nice thing brother.
Delete//////the more simpler program
ReplyDelete#include
int main()
{
int i,j,n=7;
for(i=1; i<=4; i++)
{
for(j=1; j<=n; j++)
printf("%d",j);
n-=2;
printf("\n");
}
return 0;
}
#include
ReplyDelete#include
void main()
{
int i, j;
for(i=7;i>=1;i--)
{
if(i%2 != 0)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
printf("\n");
}
}
getch();
}
good brother.
Deletethis program logic is first for(i=3;i>=1;i--)
ReplyDelete{
for(j=1;j<=(i*3+1);j++)
{
s.o.pln(j);
}
#include
ReplyDeleteint main()
{
int r,i,j;
printf("Enter the number of rows : ");
scanf("%d",&r);
for(i=r;i>=1;i--)
{
for(j=1;j<=(2*i)-1;j++)
{
printf("%d",j);
}
printf("\n");
}
return 0;
}
NsubsmoKcal_fu Cassandra Bryant https://marketplace.visualstudio.com/items?itemName=9tiograsun-fu.Silent-Footsteps-gratuita
ReplyDeletehoheadnole
Ysuppdelturpu Cindy Collins link
ReplyDeletecondculgepi
Nphafenox_ru Guy Nyhus click here
ReplyDeleteBest
click here
rigehihea
0verchoWsi-ka Antoinette Jordan software
ReplyDeleteBest
Free download
balzardfuncprev