Answer to Question #15435 in C++ for zyrus

Question #15435
Write a C++ program that would display the following output:

0123456789 1 * 1 2 3 4 5
0123456789 2 * * 1 2 3 4
0123456789 3 * * * 1 2 3
0123456789 4 * * * * 1 2
0123456789 5 * * * * * 1
1
Expert's answer
2012-09-28T07:58:26-0400
#include <iostream>
using namespace std;
void f(int a){
& int i,j,k;
& for(i=0;i<10;i++)
& cout<<i;

& cout<<" quot;<<a;
& cout<<"\t";
& for(i=0;i<a;i++)
& cout<<"*";
& cout<<"\t";
& for(i=1;i<7-a;i++)
& cout<<i<<"& ";
& cout<<i<<"\n";
& }

int main()
{
for(int i=1;i<6;i++)
f(i);


cin.get();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS