Print pattern in c - number pattern -9
Print pattern in c - number pattern
Write a program to print following pattern
1 22 333 4444 55555
Program code
#include <stdio.h>
int main()
{
int i, j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",i);
}
printf("\n");
}
return 0;
}
Step by Step solution
1. Number of row -
Is has 5row , so first loop will execute for 5 time#include <stdio.h>
int main()
{
int i, j;
for(i=1;i<=5;i++)
{......
}
return 0;
}
2. Number of character -
It has only one type of character , so there will be only one nested loop#include <stdio.h>
int main()
{
......
for(j=1;j<=i;j++)
{
printf("%d",i);
}
printf("\n");
}
3.Number of column -
It has 5 maximum column and is decreasing with row number , so the nested loop decrease it's repetation with increase in row#include <stdio.h>
............
for(j=1;j<=i;j++)
{
printf("%d",i);
}
printf("\n");
...................
return 0;
}
You can Browse related article below for more information and program code related to recursive function call
Does above is helpful , Post you views in comment
391E2D30
ReplyDeletegürcistan esçort
bartın esçort
kızılay esçort
bozüyük esçort
esçort konya
esçort iğdır
siverek esçort
esçort tekirdağ
esçort bayan osmaniye
F679B8EC
ReplyDeleteBafra
Nazilli
Tepebaşı
Döşemealtı
Biga
Karasu
Cebeci
Kemer
Ezine
C08B9BE6
ReplyDeleteDarıca
Sorgun
Çorlu
Çeşme
Keşan
Atakum
Antakya
İlkadım
Soma