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
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDelete#include
ReplyDeleteusing namespace std;
int main()
{
char c='A';
for(int n = 1; n<=5;n++)
{
for(int i = 1; i<=n;i++,c++)
{
cout<<c;
}
cout<<"\n";
}
return 0;
}
can anyone provide source code for,
ReplyDelete1
2*3
4*5*6
7*8*9*10
thanks in advance.