Question
This is exactly what I have in my program but there is errors I don't know what I am doing wrong #include void pyramid() {
This is exactly what I have in my program but there is errors I don't know what I am doing wrong
#include
int i, space, rows=7, star=0; /* Printing upper triangle */ for(i = 1; i <= rows; i++) { /* Printing spaces */ for(space = 1; space <= rows-i; space++) { printf(" "); } /* Printing stars */ while(star != (2*i - 1)) { printf("*"); star++;; } star=0; /* move to next row */ printf(" "); } rows--; /* Printing lower triangle */ for(i = rows;i >= 1; i--) { /* Printing spaces */ for(space = 0; space <= rows-i; space++) { printf(" "); } /* Printing stars */ star = 0; while(star != (2*i - 1)) { printf("*"); star++; } printf(" "); } } int main() { int a=0; printf("Enter Yes to print diamond Enter No to print Pyramid Enter your choice :"); scanf("%d",&a); if(a==Yes) diamond(); else if(a==No) pyramid(); else printf(" Wrong Input"); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started