Computer Science, asked by preksham, 5 hours ago

without return type and no parameter write a program in java to print tables of 3.

Answers

Answered by anindyaadhikari13
3

\texttt{\textsf{\large{\underline{Solution}:}}}

The given co‎de is written in Java.

public class MultiplicationTableOfThree{

   public static void main(){

       System.out.println("Multiplication Table of 3 - \n");

       for(int i=1;i<=10;i++)

           System.out.println("3 * "+i+" = "+3*i);

   }

}

\texttt{\textsf{\large{\underline{Logic}:}}}

  • Repeat from i = 1 to 10.
  •    Display the value of 3i

See the attachment for output.

Attachments:
Answered by kamalrajatjoshi94
3

Answer:

Program:-

import java.util.*;

public class Main

{

public static void main(String args[])

{

Scanner in=new Scanner(System.in);

int n,i;

System.out.println("Enter the limit of table of 3:");

n=in.nextInt();

System.out.println("The table of 3 upto "+n+":");

for(i=1;i<=n;i++)

{

System.out.println("3×"+i+"="+(3*i));

}

in.close();

}

}

Attachments:
Similar questions