Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (anonymous):

write a program using nested loop to produce the following output: & & & & & & & & & & & & & & & & write a program using nested loop to produce the following output: & & & & & & & & & & & & & & & & @Computer Science

OpenStudy (anonymous):

public class Printand { public static void main (String args[]){ System.out.println("&&&&&&&"); System.out.println(" &&&&& "); System.out.println(" &&& "); System.out.println(" & ");

OpenStudy (anonymous):

umm .... nested loop?

OpenStudy (anonymous):

for(int i =4 ; i>=0 ; i--) { if(i==4) System.out.println("&&&&&&&"); else if(i==3) System.out.println(" &&&&& "); else if(i==2) System.out.println(" &&& "); else if(i==1){ System.out.println(" & ");

OpenStudy (anonymous):

that's not nested loop, you should add one within other. here is your C++ code: #include <iostream> using namespace std; int main(void){ int row=7,col; for(col=4;col>=1;col--){ for(int null=4;null>col;null--) cout<<" "; for(row=row-2*(4-col);row>=1;row--){ cout<<"A"; } row=7; cout<<"\n"; } return(0); }

OpenStudy (anonymous):

If you want to find out the logic, this one is better for you: #include <iostream> using namespace std; int main(void){ int row,col,temp=7,space,a=0; for(col=4;col>=1;col--){ for(space=0;space<a;space++){ cout<<" "; } for(row=temp;row>=1;row--){ cout<<"&"; } a=a+1; temp=temp-2; cout<<"\n"; } return(0); }

OpenStudy (anonymous):

thanks a lot....:)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!