0

thier is wrong things in this code l could not find it

#include<iostream> using namespace std; int main() { int e=9; cout<<"\"Upside Down Triangle\":\n\n"; for(int a=1;a<=5;a++) { for(int b=0;b<e;b++) { cout<<"*"; } cout<<endl; e=e-2; for(int c=0;c<a;c++) { cout<<" "; } } return 0; }

12th Apr 2020, 6:53 AM
Shahed
Shahed - avatar
7 Antworten
+ 1
When you keep e=e-2 you'll get the output as.. ********* ******* ***** *** * If you remove it you'll get the output as *********** ************ ************** **************** ******************
12th Apr 2020, 7:28 AM
sarada lakshmi
sarada lakshmi - avatar
+ 1
your code seem correct, but I made some modifications to adapt it to any input, not 9 only! https://code.sololearn.com/c1Ein4kkbWYw/?ref=app
12th Apr 2020, 7:29 AM
John Robotane
John Robotane - avatar
0
What output do you want? According to your logic it's right I think!! 🤔 No errors If you mention your output then I can try.. But one thing, instead of \n you can have endl in cpp..
12th Apr 2020, 7:12 AM
sarada lakshmi
sarada lakshmi - avatar
0
*********** ************ ************** **************** ****************** the output be like this
12th Apr 2020, 7:19 AM
Shahed
Shahed - avatar
0
Then remove e=e-2 and check it once
12th Apr 2020, 7:20 AM
sarada lakshmi
sarada lakshmi - avatar
0
I want the output be like this ********* ******* ***** *** *
12th Apr 2020, 7:24 AM
Shahed
Shahed - avatar
0
ok thx
12th Apr 2020, 7:29 AM
Shahed
Shahed - avatar