C CODES TO PRINT PATTERNS of NUMBERS STARS AND SYMBOLS
PATTERNS of NUMBERS STARS
*
**
***
****
*****
we have shown 5 rows above, in the software you may be asked to enter the numbers of rows you need to print in the pyramid of stars. C programming code
sample numbers stars smables
programming codes for the above patterns is given below ande you may change it consistent with your preference.
#include <stdio. H>
#include <conio. H>
int essential()
int n, c, okay;
printf(“input range of rowsn”);
scanf(“%d”,&n);
for ( c = 1 ; c <= n ; c++ )
for( ok = 1 ; ok <= c ; ok++ )
printf(“*”);
printf(“n”);
getch();
instance no 2
the following sample is given underneath and we must write its code and software will asks you how an awful lot rows of pattern you need to print
*
***
*****
*******
*********
because there are 5 rows of above program so we will provide five rows to program. The code of sample is given under
#consist of <stdio. H>
#consist of <coni0. H>
void main()
int row, c, n, temp;
printf(“input the wide variety of rows in pyramid of stars you desire to see “);
scanf(“%d”,&n);
temp = n;
for ( row = 1 ; row <= n ; row++ )
for ( c = 1 ; c < temp ; c++ )
printf(” “);
temp–;
for ( c = 1 ; c <= 2*row – 1 ; c++ )
printf(“*”);
printf(“n”);
getch();
the output of the above code is
the usage of those examples you are in a better role to create your favored pattern for yourself. Developing a sample involves the way to use nested loops properly, some sample may also contain alphabets or other unique characters. Key aspect is understanding how the characters in pattern exchange. C pattern applications instance 3
pattern:
#
#a#
#a#a#
#a#a#a#
c sample program of hash and a:
#consist of<stdio. H>
#encompass<stdio. H>
void important()
clrscr();
int n, c, ok, area, count = 1;
printf(“input variety of rowsn”);
scanf(“%d”,&n);
space = n;
for ( c = 1 ; c <= n ; c++)
for( ok = 1 ; okay < area ; okay++)
printf(” “);
for ( k = 1 ; k <= c ; k++)
printf(“#”);
if ( c > 1 && remember < c)
printf(“a”);
count++;
printf(“n”);
space–;
matter = 1;
getch();
sample:
1
232
34543
4567654
567898765
c program:
#encompass<stdio. H>
#encompass<stdio. H>
void foremost()
int n, c, d, num = 1, space;
scanf(“%d”,&n);
space = n – 1;
for ( d = 1 ; d <= n ; d++ )
num = d;
for ( c = 1 ; c <= area ; c++ )
printf(” “);
space–;
for ( c = 1 ; c <= d ; c++ )
printf(“%d”, num);
num++;
num–;
num–;
for ( c = 1 ; c < d ; c++)
printf(“%d”, num);
num–;
printf(“n”);
getch();