Write a complete C++ program that does the following: a. Prompts user to enter a
ID: 3682094 • Letter: W
Question
Write a complete C++ program that does the following: a. Prompts user to enter a positive odd integer n < 30. If the inputted value is incorrect, the program repeatedly force user to input values until n is within the expected value. b. The program then prints the two diagrams – large asterisks sign, and a plus sign. For example, if the user enters 9 for n, the output is as seen above^
Using a for loop in one program please! No abs value!
Write a complete C++ program that does the following 1. The program asks user to enter a positive odd integer 4nExplanation / Answer
1 .Program to ask user enter a Positive odd integer 4<n<30
#include <iostream>
using namespace std;
int main()
{
int rows,i,j,space;
cout<<"Enter value between 4 and 30"<<endl;
cin>>rows
if (rows > =4 && rows <=30){
for(i=rows;i>=4;--i)
{
for(space=0;space<rows-i;++space)
cout<<" ";
for(j=i;j<=2*i-1;++j)
cout<<"* ";
for(j=0;j<i-1;++j)
cout<<"* ";
cout<<endl;
}
for(i=1;i<=rows;++i)
{
for(space=1;space<=rows-i;++space)
{
cout<<" ";
}
while(k!=2*i-1)
{
cout<<"* ";
++k;
}
k=0;
cout<<" ";
}
}
else{
cout<<"your Enter value is not in between 4 and 30"<<endl;
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.