Sunday, 8 April 2018

One interesting application of computers is drawing graphs and bar charts (sometimes called “histograms”). Write a program that reads five numbers (each between 1 and 30). For each number read, your program should print a line containing that number of adjacent asterisks. For example, if your program reads the number seven, it should print

using namespace std;
#include<iostream>
#include<conio.h>
int main()
{
int i,j,a;
for(i=0;i<5;i++)
{
cout<<"Enter the number:";
cin>>a;
for(j=1;j<=a;j++)
{
cout<<"* "<<endl;
}

}
return 0;
}

No comments:

Post a Comment