The solution of printing "CPROGRAMMING" as =>

Bismillahir Rahmanir Rahim
At first see the picture and try to solve the problem.(tips: to solve this problem you need to know about array, string and for loop) if you don't solve it ,then see the solution .if you improve your programming skills "there is no alternate way of practice ".
Solution:

1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include<stdio.h>
void main()
{
  int i,j,k,l,m,n,p=0;
  char a[12]="CPROGRAMMING";
  for(i=0;i<12;i++)
   {
     for(j=i;j<11;j++)
     {
      printf(" ");
     }
     for(k=0;k<=i;k++)
     {
      printf("%c",a[k]);
     }
       for(m=0;m<=i;m++)
     {
      printf("%c",a[m]);
     }
     printf("\n");

   }

   for(i=11;i>=0;i--)
    {
     for(j=0;j<=i;j++)
     {
      printf("%c",a[j]);
     }
     if(i<11)
     {
      for(m=1;m<=p*2;m++)
       printf(" ");

     }
    

     for(j=0;j<=i;j++)
     {
      printf("%c",a[j]);
     }
     printf("\n");
     p=p+1;
    }

}
if you have to solve this problem,comment below .

Socializer Widget By Blogger Yard
SOCIALIZE IT →
FOLLOW US →
SHARE IT →