Using C program Thanks Write a program that prints a diamond

Using C program. Thanks

Write a program that prints a diamond, as shown here:

Solution

Answer:

#include <stdio.h>

#include <conio.h>

#include <process.h>

#include <string.h>

void main()
int a, b, c;

int n = 0;

Printf(\"program to display outline of *.\ \");

Printf(\"Enter the max number of *:\");

Scanf(%d, &n);

Printf(\"\ Diamond of *\ \");

for(a =1 ; a<=n;;a++)

{

for(b = 0 ; b<(n-a); b++)
print(\" \");

for(b = 1 ; b<=a; b++)

if(b ==1) printf(\"*\"); else printf(\'\' \'\');

for(c=1; c<a;c++)
if(c==a-1) printf(\'*\"); else printf(\" \");

printf(\"\ \");

}

for(a = n -1; a> =1; a++)

{

for(b =0; b<(n-a;b++)

printf(\'\' \'\');

for(b = 1 ; b< = a; b++)

if(b ==1) printf(\"*\"); else prinf(\" \");

for(c = 1; c<a;c++)

if(c==a-1) printf(\"*\"); else printf(\" \");

printf(\"\ \");

}
printf(\"\ \");

}

Using C program. Thanks Write a program that prints a diamond, as shown here: SolutionAnswer: #include <stdio.h> #include <conio.h> #include <pro
Using C program. Thanks Write a program that prints a diamond, as shown here: SolutionAnswer: #include <stdio.h> #include <conio.h> #include <pro

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site