Exp 1.1 Java
Exp 1.1 Java
Experiment Number :
1.1
AIM OF THE EXPERIMENT :- Write a program to print table by taking input from the
user. In the form of “2 x 1 = 2”.
Objective :-We will be able to learn & implement different types of loops.
Source Code:
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
int N = Integer.parseInt(bufferedReader.readLine().trim());
for( int i=1;i<=10;i++)
{
System.out.println(N+" x "+i+" = "+i*N);
}
bufferedReader.close();
}
}
Output:
Source Code:
import java.util.*;
import java.io.*;
import java.lang.Math;
class Solution{
public static void main(String []argh){
Scanner in = new Scanner(System.in);
int t=in.nextInt();
int d=0;
for(int i=0;i<t;i++){
int a = in.nextInt();
int b = in.nextInt();
int n = in.nextInt();
for ( int j=1;j<=n;j++)
{
d = (int)Math.pow(2,j);
int c = a + b*(d-1);
System.out.print(c+" ");
}
System.out.println();
}
in.close();
}
}
Output:
Evaluation Grid :
Sr. No. Parameters Marks Obtained Maximum Marks
1. Student Performance 12
(Conduct of experiment)
objectives/Outcomes.
2. Viva Voce 10
3. Submission of Work Sheet 8
(Record)
Total 30