Q:

Write a program in C++ to input a single digit number and print a rectangular form of 4 columns and 6 rows

0

Write a program in C++ to input a single digit number and print a rectangular form of 4 columns and 6 rows

Sample Output:

 Make a rectangular shape by a single digit number :                   
--------------------------------------------------------               
 Input the number : 5                                                  
 5555                                                                  
 5  5                                                                  
 5  5                                                                  
 5  5                                                                  
 5  5                                                                  
 5555

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>
using namespace std;

    int main()
    {
    	int x;
		cout << "\n\n Make a rectangular shape by a single digit number :\n";
		cout << "--------------------------------------------------------\n";		
        cout<<" Input the number : ";
    	cin>> x;
        cout<<" "<<x<<x<<x<<x<<endl;
        cout<<" "<<x<<" "<<" "<<x<<endl;
        cout<<" "<<x<<" "<<" "<<x<<endl;
        cout<<" "<<x<<" "<<" "<<x<<endl;
        cout<<" "<<x<<" "<<" "<<x<<endl;        
        cout<<" "<<x<<x<<x<<x<<endl;        
        cout << endl;
        return 0;
    }

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now