Post Page Advertisement [Top]

Make pattern of A to Z with star* C-Programming

How to Make a Program in C to Make Capital "D" with star * ?

" Make a Program in C to Make Capital D with star * "

Steps of programming:-

  1. Initialize two variable  (e.g: int x,y;)
  2. Start a loop from x=1 to x=7.
  3. In this loop first we use if statement for print "*"s at the top.
  4. For printing "*"s we simply start a loop from y=1 to y=4 because we want to print "*" 4-times.
  5. Then we use else if statement for print   "* * *" in the last.
  6. And also for printing "* * *" we simply start a loop from y=1 to y=4 because we want to print "*" 4-times.
  7. And in else section we simply print "*" because we need "*      *" in both side 
  8. Then our program is completed.

code:


#include<stdio.h>
#include<conio.h>
void main()
{int x,y;
clrscr();
for(x=1;x<=7;x++)
 { if (x==1)
for(y=1;y<=4;y++)
printf("* ");
else if (x==7)
      { printf("\n");
for(y=1;y<=4;y++)
printf("* ");  }
else
printf("\n*      *");
}
getch();
}
DizIT_Operators 
Thank-You

No comments:

Post a Comment

Bottom Ad [Post Page]