Silahkan Melihat Tutorial di website kami dengan nyaman ENJOY YOUR LIFE ☕

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


/************************************************************
The output of above program would be:
*************************************************************/


Output of Floyd Algorithm Character Pattern In C
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

Floyd Algorithm Character Pattern In C