You are on page 1of 5

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Experiment No. 1

Student Name: Vishnu Vishvas Sharma UID: 21BCS5240


Branch: Computer Science & Engineering Section/Group: 617 B
Semester: 3rd Date of Performance: 26/08/2022
Subject Name: OOPS using JAVA Subject Code: 21CSH218

1. Aim:
Hackerrank problem related to loops.

2. Problem statement:
Given an integer, N, print its first 10 multiples. Each multiple N*I (Where 1<=i<=10) should be printed on a
new line in the form: N* I = Results.

3. Introduction:
To print the first 10 multiples of a number we need to execute the program using loops, as loops allow us to
execute the number of iterations in a go. In this program, as we know the number of iterations to be executed so
I have used for loop to create the table. Also, I have taken the number from the user, of which we need to print
the multiples.

4. Software Used:

Hackerrank

5. Hardware requirements:

Processor= AMD RYZEN 3


RAM= 8.00 GB
SSD= 512 GB
Keyboard and Mouse.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

6. Algorithm:
1) Start.
2) Take N as input. Initialize i=1.
3) Print N*i.
4) Repeat 3 using for loop a total of 10 times and increment i with 1 each time.
5) Stop.

7. Code:

import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
import java.util.Scanner;

public class Solution {


public static void main(String[] args) {
int n;
Scanner scan = new Scanner(System.in);
n=scan.nextInt();

for(int i=1;i<11;i++){
System.out.println(n+" x "+i+" = "+n*i);
}

}
}
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

8. Observations, Simulation Screen Shots, and Discussions:


DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

9. Additional Creative Inputs (If Any):


Took input from the user.

10. Learning outcomes (What I have learned):


1. Basics of Java

2. To implement loops in JAVA

3. To take input from users in JAVA

4. To print the result using JAVA programming

5. Concept of classes in JAVA

You might also like