Make pattern of A to Z with star* C-Programming
How to Make a Program in C to Make Capital B with star * ?
" Make a Program in C to Make Capital B with star * "
Steps of programming:-
- Initialize two variable (e.g: int x,y;)
- Start a loop from x=1 to x=7.
- In this loop first we use if statement for print"* * *" at the top.
- For printing "* * *" we simply start a loop from y=1 to y=3 because we want to print "*" 3-times.
- Then we use else if statement for print "* * *" in the middle.
- And also for printing "* * *" we simply start a loop from y=1 to y=3 because we want to print "*" 3-times.
- Then also we use else if statement for print "* * *" in the last.
- And also for printing "* * *" we simply start a loop from y=1 to y=3 because we want to print "*" 3-times.
- And in else section we simply print "* *" because we need "*" in both side
- 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<=3;y++)
printf("* ");}
else if(x==7)
{ printf("\n") ;
for (y=1;y<=3;y++)
printf("* "); }
else
printf("\n* *"); }
getch();
}
OUTPUT |
Thank-You
No comments:
Post a Comment