How do you write the following code in BASIC cout<<\"Enter the range: \"\' cin>>
ID: 3609250 • Letter: H
Question
How do you write the following code in BASIC cout<<"Enter the range: "' cin>>range; cout<<"The number of rows in the diamond are - "<<(2* range-1); cout<< endl; For(i=0; i<range; i++) { for(j=0; j<=range-i; j++) cout<<" "; for(j=range-i; j<= range+i; j++) cout<<"*"; cout<<endl; } For(i =2; i <=range; i+-) { for(j=0; j<=i; j++) cout <<" "; for(j = i; j<=(2 * range-i); j+-) cout <<"*"; cout<< endl; } I know how to do some but I get hung up on "j+-" and"range-i". Thanks for the previous help. I rated you. How do you write the following code in BASIC cout<<"Enter the range: "' cin>>range; cout<<"The number of rows in the diamond are - "<<(2* range-1); cout<< endl; For(i=0; i<range; i++) { for(j=0; j<=range-i; j++) cout<<" "; for(j=range-i; j<= range+i; j++) cout<<"*"; cout<<endl; } For(i =2; i <=range; i+-) { for(j=0; j<=i; j++) cout <<" "; for(j = i; j<=(2 * range-i); j+-) cout <<"*"; cout<< endl; } I know how to do some but I get hung up on "j+-" and"range-i". Thanks for the previous help. I rated you.Explanation / Answer
please rate - thanks I think you copied the +- incorrectly, no such thin CLS INPUT "Enter the Range "; range PRINT "The number of rows in the diamond are-"; 2 * range - 1 FOR i = 0 TO range FOR j = 0 TO range - i PRINT " "; NEXT j FOR j = range - i TO range + i PRINT "*"; NEXT j PRINT " " NEXT i FOR i = 2 TO range FOR j = 0 TO i PRINT " "; NEXT j FOR j = i TO 2 * range - i PRINT "*"; NEXT j PRINT " " NEXT i
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.