Write a program to print table of a number 9
Answers
Answered by
0
Answer:
WARNING only for Java users...I will send for other languages later...
import java.util.*;
class table
{
public static void main()
{
Scanner sc= new Scanner(System.in);
System.out.print("Input limit:");
int t=sc.nextInt(),i=1,calc=0;
for(;i<=t;i++)
{
calc+=9;
System.out.println("9*"+i+"="+calc);
}
sc.close();
}
}
Explanation:
Here I is used for looping and t is used to take input from user of how far to calculate and calc calculates the table for you...
calc+=9 means that it is adding 9 to itself everytime the loop is running since we know that multiplication is actually number of times it is added to itself...
from Rouvik Maji,
May it help you...
Similar questions