Post Page Advertisement [Top]

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

How to Make a Program in C to Make Capital A with * ?

" Make a Program in C to Make Capital A with * "

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"* * *" at the top.
  4. For printing "* * *" we simply start a loop from y=1 to y=3 because we want to print "*" 3-times.
  5. Then we use else if statement for print   "* * *" in the middle.
  6. And also for printing "* * *" we simply start a loop from y=1 to y=3 because we want to print "*" 3-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)
        {
printf("\n");
for (y=1;y<=3;y++)
printf(" *");
}
else if(x==4)
{
printf("\n");
for (y=1;y<=4;y++)
printf("* ");
}
else
printf("\n*     *"); 
}
getch();
}
OUTPUT

#DizIT_Operators
Thank-You

No comments:

Post a Comment

Bottom Ad [Post Page]