here's the question..
Write a program that will display the pattern below depending on the value of n.
Sample output:
Enter a value of n: 4
output:
*
**
***
****
***
**
*
i need ur response
Ive tried answering it and here’s my work:
#include<iostream>
using namespace std;
main()
{
int a;
cout<<"Enter a value of n: ";
cin>>a;
cout<<endl;
for(int x=1; x<=1; x++)
{
for (int y=1;y<=1;y++)
cout<<"*";
cout<<endl;
}
for(int x=1; x<=1; x++)
{
for (int y=1;y<=2;y++)
cout<<"*";
cout<<endl;
}
for(int x=1; x<=1; x++)
{
for (int y=1;y<=3;y++)
cout<<"*";
cout<<endl;
}
for(int x=1; x<=1; x++)
{
for (int y=1;y<=4;y++)
cout<<"*";
cout<<endl;
}
for(int x=1; x<=1; x++)
{
for (int y=1;y<=3;y++)
cout<<"*";
cout<<endl;
}
for(int x=1; x<=1; x++)
{
for (int y=1;y<=2;y++)
cout<<"*";
cout<<endl;
}
for(int x=1; x<=1; x++)
{
for (int y=1;y<=1;y++)
cout<<"*";
cout<<endl;
}
system("pause");
return 0;
}
Sad to say it’s still wrong.
This post has been edited by no2pencil: 25 June 2012 - 01:39 AM
Reason for edit:: Corrected code tags

New Topic/Question
Reply



MultiQuote



|