repl.it
@SylvianBryan/

Project 3 Print 1 * 2** 3*** 4**** 5***** 6******

C

No description

fork
loading
Files
  • main.c
  • main
main.c
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
47
48
49
50
51
52
53
54
55
56
/*Prototype - N01422856 Sylvian Bryan. 2019/04/10. This program pattern numbers follow by stars using various Loops*/

#include <stdio.h>

void aster (int star);//function 

int main(void) 
{
int num=1; 
int mid=2;
int x=3;
int high=6;
int end=4;
int star; 
int row;

for (row=num; row <=num;++row)//Row 1
printf("\n\n                   %d\n", row); 

star=row; 
aster(star);

for (row=mid; row<=x;++row)// Row 2
printf("           %d    ",row);
printf("\n");

row=x;
star=row;
aster(star);

while (row+1<=high)// Row 3
printf("  %d              ", row++);
printf("\n");

star=high;
aster(star);

printf ("\n\n\nThis program consisted of a function with\nthree conditions and loops."); 

return 0;
}

void aster(int star)
{ 

if (star==2){
printf("                   *\n\n");}

if (star==3){
printf("          * *             ***\n\n");}

if (star==6){
printf("** **            *****           *** ***\n");}

return; 
}