E DE CDE BCDE ABCDE #include <stdio.h> int main() { int i, j; for(i=5;i>=1;i--) { for(j=i;j<=5;j++) { printf("%c",'A' + j-1); } printf("\n"); } return 0; }
//A much simpler code than yours#includemain(){ int n, i,j; printf("Enter the no of rows"); scanf("%d",&n); int k; for(i=1; i<=n; i++) { for(j=1; j<=i; j++) { printf("%c",'A'+n-j); } printf("\n"); }}
D you run your code? It is not the right code for that output.
yes its working, check here http://codepad.org/NSBu7V4T
not right code
//A much simpler code than yours
ReplyDelete#include
main()
{
int n, i,j;
printf("Enter the no of rows");
scanf("%d",&n);
int k;
for(i=1; i<=n; i++)
{
for(j=1; j<=i; j++)
{
printf("%c",'A'+n-j);
}
printf("\n");
}
}
D you run your code? It is not the right code for that output.
Deleteyes its working, check here http://codepad.org/NSBu7V4T
Deletenot right code
ReplyDelete