c language pattern program
please anyone answer by clicking the image and see what pattern ia that
Attachments:
Answers
Answered by
3
The given problem is solved using language - C.
#include <stdio.h>
int main() {
int i,j,n=6;
for(i=1;i<=n;i++){
for(j=1;j<=i;j++){
if(j==1)
printf("%c ",64+i);
else if(j==i)
printf("%d ",i-1);
else
printf("* ");
}
printf("\n");
}
return 0;
}
The output for the program is:
A
B 1
C * 2
D * * 3
E * * * 4
F * * * * 5
Note: If you want to take the number of rows as input from the user, then use scanf() function to take 'n' as input.
Attachments:
anindyaadhikari13:
If you have any question regarding this code, message me.
Similar questions
Math,
19 days ago
Chemistry,
19 days ago
World Languages,
19 days ago
Social Sciences,
9 months ago
Science,
9 months ago