Write a program that uses loops to print out a design of following using asterisks:
* * * * *
* *
* * * * *
* * * * *
* *
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
The program should only use the following print statements:
print(“* * * * *”)
print(“* *”)
print(“\n”)
#include<iostream>
using namespace std;
int main()
{
for(int i=0;i<12;i++)
{
if(i==1||i==4)
printf("**");
else if(i==6||i==9){}
else
printf("*****");
printf("\n");
}
}
Comments
Leave a comment