Tuesday, 10 March 2015

Draw Square shape in C++ / C code in which user enter its desire size of Square. Using nested for loop and Digits

Leave a Comment
Code:
#include<iostream>
using namespace std;
void main()
{
int size=0;
cout<<"Enter size = ";
cin>>size;
//outer loop for handling columns
for(int i=0;i<5;i++)
{
//inner loop is for handling rows
for(int i=0;i<size;i++)
{
cout<<i+1<<"  ";
}
cout<<endl;
}
}
Output:


If You Enjoyed This, Take 5 Seconds To Share It