Java Lab2

Problem: 2.1

Question 2.1: Write a Java program to print 'Hello' on screen and then print your name …

Problem: 2.2

Question 2.2: A school has following rules for grading system: a. Below 25 - F b. 25 to 45 - E …

Problem 2.3

Question 2.3: Create a function that takes two numbers as arguments and returns the GCD of the …

Problem: 2.4

Question2.4:Given an integer, create a function that returns the next prime. If the number is p…

Problem: 2.5

Question 2.5:Write a Java program that takes two numbers as input and display the product of tw…

Problem:2.6

Question 2.6: Write a Java program to print the sum (addition), multiply, subtract, divide and r…

problem: 2.7

Question 2.7:  Write a Java program that takes a number as input and prints its multiplication …

problem: 2.8

Question 2.8: Create a function that finds how many prime numbers there are, up to the given in…

Problem: 2.9

Question 2.9 : Write a Java program to compute a specified formula. Specified Formula: 4.0 * (1 …

Problem: 2.10

Question 2.10: Write a Java program to print the area and perimeter of a circle. Test Data: Radi…

Problem: 2.11

Question 2.11: Write a Java program that takes three numbers as input to calculate and print th…

Problem:2.12

Question 2.12: Write a Java program to print the area and perimeter of a rectangle. Test Data: …

Problem 2.13

Question 2.13: Write a Java program to swap two variables. Solution:  package com.company; impo…

Problem: 2.14

Question 2.14: Write a Java program to compare two numbers. Input Data: Input first integer: 25…

Problem: 2.15

Question 2.15: Write a Java program and compute the sum of the digits of an integer. Input Data…

Problem: 2.16

Question 2.16:  Write a Java program to print the odd numbers from 1 to 99. Prints one number pe…

Problem: 2.17

Question 2.17: Create a function that takes an integer n and reverses it. Examples rev(5121) ➞ &…

Problem: 2.18

Question 2.18: Write a Java program to calculate the sum of two integers and return true if the…

Problem: 2.19

Question 2.19 : Write a Java program that accepts three integer values and return true if one of…

Problem: 2.20

Question 2.20: Write a Java program that accepts two integer values between 25 to 75 and return …

Load More
No results found