In: Computer Science
Write a program that uses nested for loops to print a multiplication table. Your program should print out the multiplication table starting a 1 and going to 12. Output should be like:
1 x 1 =
.1 x 2 = 2
Hi i am answering your question , As you did not mentioned any specific language hence i am solving it with C++ ,hope this will be helpful to you.
Code:-
#include<iostream>
using namespace std;
int main()
{
int num = 12 ; //as u need upto 12
for(int k =1 ; k<=num ; k ++) { // loop to traverse from 1 to
12
for(int a=1;a<=10;a++) { // loop to print table
cout<<k<<" x "<<a<<" =
"<<k*a<<endl; // Displaying output
}
}
return 0;
}
output:-
.
.
.
happy to help , if you have any doubt regarding the same kindly comment, and if it helps you then please give a thumbs up.