- Write a program to display the following pattern using setw:
*
***
*****
*******
#include <iostream>
#include <iomanip> //introducing library for setw() manipulator
using namespace std;
int main()
{
cout<<setw(6)<<"*\n" //setting set width
<<setw(7)<<"***\n" //setting set width
<<setw(8)<<"*****\n" //setting set width
<<setw(9)<<"*******\n"; //setting set width
return 0;
}
No comments:
Post a Comment