Pro List Oop
Pro List Oop
if else Program
1. WAP to check no. is positive or negative.
2. WAP to check age is greater than 18 or not.
3. WAP to check number is even or odd
4. WAP to check no. is positive or negative or zero
5. WAP to check greatest of three numbers
6. WAP to check lowest of three numbers
7. WAP to check year is leap or not
8. WAP for grading system
• if percentage > 75 distinction
• percent between 60 & 75 1st
• percent between 45 to 60 2nd
• percent between 35 to 45 3rd
• percent less than 35 fail
9. WAP to check person eligible for donating blood.
if age > 18 and weight > 50 eligible else not
10.WAP to check maximum between two numbers.
HTGwalani
Loops
1 Write a program to find the sum of the first N natural numbers.
2. Write a program to calculate the factorial of a given number.
3. Write a program to reverse a given integer.
4. Write a program to calculate the sum of digits of a given number.
5. Write a program to check if a number is prime or not.
6. Write a program to print the first N terms of the Fibonacci series.
7. Write a program to find the greatest common divisor (GCD) of two numbers.
8. Write a program to find the sum of all even numbers up to N.
9. Write a program to count the number of digits in a given number.
10. Write a program to check whether a given number is a palindrome.
11. Write a program to print Multiplication Table.
12.Explain various loops used in JAVA and also write a program to calculate the
following sum: 5+10+15+20+…..+100
13. Write a java program to print the square of first 10 even numbers.
Nested Loops:
1. Print a Right-Angled Triangle
Write a program to print a right-angled triangle pattern using nested loops:
*
**
***
****
123
123
123
7. Floyd’s Triangle
Write a program to print Floyd's triangle using nested loops:
1
23
456
7 8 9 10