ABCDE ABCD ABC AB A #include <stdio.h> int main() { int i, j; for(i=5;i>=1;i--) { for(j=1;j<=i;j++) { printf("%c",'A' + j-1); } printf("\n"); } return 0; }
what is the logic behind 'A' + j-1
it is adding the numeric in ASCII values of 'A'
what code we will write to get the same output without using loop....but by using goto or of else statement...???
#include #includemain(){ int n,i,l; printf("enter the number of lines :"); scanf("%d",&n); for(l=1;l<=n;l++) { for(i=1;i<=n+1-l;i++) { printf("%c",'A'+i-1); } printf("\n"); } getch();}
what is code of alphabet reverse triangle pattern not a pyramid
How to print same triangle using while loop?
what is the logic behind 'A' + j-1
ReplyDeleteit is adding the numeric in ASCII values of 'A'
Deletewhat code we will write to get the same output without using loop....
ReplyDeletebut by using goto or of else statement...???
#include
ReplyDelete#include
main()
{
int n,i,l;
printf("enter the number of lines :");
scanf("%d",&n);
for(l=1;l<=n;l++)
{
for(i=1;i<=n+1-l;i++)
{
printf("%c",'A'+i-1);
}
printf("\n");
}
getch();
}
what is code of alphabet reverse triangle pattern not a pyramid
ReplyDeleteHow to print same triangle using while loop?
ReplyDelete