Answers for "multiplication table c++ for loop"

C++
0

multiplication table c++ for loop

#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

int main()
{
	cout << " X"; 
	for (int q = 1 ; q<=10 ; q++)
	{
		cout << setw(4) << q ; 
	}
	
	cout<< "\n";
	
	for (int i = 1 ; i<=10 ; i++)
	{
		cout << setw(2) << i; 
		for (int j = 1; j<= 10 ; j++)
		{
			cout << setw(4) << j*i; 
		}
		
		cout << "\n";
	}
}
Posted by: Guest on October-21-2021

Browse Popular Code Answers by Language