Q. WAP (Write A Program) to making the floyd algorithm character pattern in C as:
A
BC
DEF
GHIJ
KLMNO
Ans.
/*c program for floyd algorithm character pattern*/
#include<stdio.h>
int main()
{
int n=5,x='A';
char r,c;
for(r='A'; n>=1; r++, n--)
{
for(c='A'; c<=r; c++, x++)
printf("%c", x);
printf("\n");
}
getch();
return 0;
}
Your might also like:
A
BC
DEF
GHIJ
KLMNO
Ans.
/*c program for floyd algorithm character pattern*/
#include<stdio.h>
int main()
{
int n=5,x='A';
char r,c;
for(r='A'; n>=1; r++, n--)
{
for(c='A'; c<=r; c++, x++)
printf("%c", x);
printf("\n");
}
getch();
return 0;
}
/************************************************************
The output of above program would be:
*************************************************************/
Figure: Screen shot for Floyd Algorithm Character Pattern In C |
Your might also like:
1
2 3
4 5 6
7 8 9 10
9
8 7
6 5 4
3 2 1 0
1
2 3
4 5 6
7 8 9 10
4 5 6
2 3
1
0 komentar:
Post a Comment