0% found this document useful (0 votes)
19 views

Loop Assignments

Uploaded by

Mr. Robot
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Loop Assignments

Uploaded by

Mr. Robot
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

1. WAP to print even numbers from 121 to 229 using for loop.

2. WAP to print odd numbers from 521 to 229 using while loop.
3. WAP to print even numbers from 121 to 229 using do-while loop.
4. WAP to show the use of break statement ( in for loop)
5. Write a Java program to print all alphabets from a to z. - using for loop
6. Write a Java program to find sum of all even numbers between 1 to n.
7. Write a Java program to find sum of all odd numbers between 1 to n.
8. Write a Java program to count number of digits in any number
9. Write a Java program to calculate product of digits of any number.
10. Write a Java program to find frequency of each digit in a given integer.
11. Find all prime number between 400 to 300;
12. 7.WAP to print table of given no
13. 8.WAP to print squares from 1 to20
14. 9WAP to accept base and index from user and calculates power
15. s=1!+2!+3!.........+n! find s
16. check no is krishnamurthi or not
145=1!+4!+5!=145
17. Disarum no 135=1+3*3+5*5*5=135
18. check no is palimdrom or not
19. check no is automorphic or not
input n=25
output Automorphic
as 25*25=625

Additional

1. Write a program in Java to display the first 10 terms of the following series:

10, 20, 30, 40, ……..

2. Write the program in Java to display the first ten terms of the following series:

1, 4, 9, 16,

3. Write the program in Java to display the first ten terms of the following series:

1, 2, 4, 7, 11,

4. Print Series 2 -4 6 -8………n terms

5. Print Series 1 11 111 111……..n terms


6. Print Pattern
7.
20. Write a program that takes the quantity of milk and oil as input from user. Milk is 40
rs. per liter and oil is 50 rs. per liter. Take the input from user till the total exceeds
500. If total exceeds 500 display the quantity of milk and oil entered.

21. The temperature of a chemical is 100 degree celsius. Every hour the temperature
drops by 7 degrees. Display the hours till the temperature drops below 60 degrees
22. write a program that takes a number as input from user. The key number is 4 and
the user enters single digit numbers. Ask the user for a number till he gets the
correct answer. Then display the number of tries it took to guess the correct
number.

23. You have hundred items (1,2,3,…100) the price of each item is the same as its
number. i.e., item 1 is of 1 rs. Item 2 is of 2 rs. And so on.
Calculate the total of the items.
24. You have 20 barrels of fuel. The price per barrel is 89rs. For the first 10 barrels. If
someone wants more than 10 barrels, the price reduces by the number of barrels
bought.
For e.g. the price of 6 barrels is 6 * 89
But price of 12 barrels is 12 * (89 - 12)
or price of 18 barrels is 18 * (89 - 18) and so on.
Display all the prices from 1 to 20 barrels.

You might also like