Question 34 : Write a program in Java to print the multiplication table of a number :
Specimen (shown for 10) :
10x1=10
10x2=20
10x3=30
10x4=40
10x5=50
10x6=60
10x7=70
10x8=80
10x9=90
10x10=100
Java Program :
public class multiplication_table
{
public static void main(int a)
{
int i,d;
System.out.println("Your multiplication table is as follows : \n");
for (i=1;i<=10;i++)
{
d=a*i;
System.out.println(a+"x"+i+"="+d);
}
}
}
Specimen (shown for 10) :
10x1=10
10x2=20
10x3=30
10x4=40
10x5=50
10x6=60
10x7=70
10x8=80
10x9=90
10x10=100
Java Program :
public class multiplication_table
{
public static void main(int a)
{
int i,d;
System.out.println("Your multiplication table is as follows : \n");
for (i=1;i<=10;i++)
{
d=a*i;
System.out.println(a+"x"+i+"="+d);
}
}
}
No comments:
Post a Comment