Q. WAP (Write A Program) to making the floyd algorithm character pattern in C as:

Floyd Algorithm Character Pattern In C

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;
}

No comments:

Post a Comment