Answer to Question #245381 in C++ for kate

Question #245381

How to create a program that generates a reverse triangle bearing the numbers of the multiplication table on the user's encoded number. + The user will input any positive whole number that should be greater than 1 and not be greater than 40. If the input is outside the range display "INVALID". 


sample input: 5

Sample Output :

1.2.3.4.5

2.4.6.8

3.6.9

4.8

5


Sample Input :10

Sample Output :

01.02.03.04.05.06.07.08.09.10

02.04.06.08.10.12.14.16.18

03.06.09.12.15.18.21.24

04.08.12.16.20.24.28

05.10.15.20.25.30

06.12.18.24.30

07.14.21.28

08.16.24

09.18

10


1
Expert's answer
2021-10-02T01:37:12-0400
#include<iostream>
#include<conio.h>
using namespace std;


int main(){
	int n,cols;
	cout<<"Enter the number of rows: ";
	cin>>n;
	int num=0;
	while(n>=0){
		cols=0;
		num+=1;
		while(cols<n){
			cout<<(cols+1)*(num)<<"\t";
			cols+=1;
		}
		n-=1;
		cout<<"\n";
	}
}

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