1.java Basic Programs1
1.java Basic Programs1
No Practical List
1 WAP to calculate the Area of a Circle, Area and Perimeter of rectangle, Area
of Triangle.
2 WAP that reads two nos. from key board and gives their addition,
subtraction, multiplication, division and modulo.
3 WAP to enter three subject marks, and calculate total, percentage of student
and display the same in proper format.
4 WAP to convert days into months and days.
5 WAP that converts Fahrenheit temperature to centigrade and vis-a-versa
Cent.=(5* (fahr.-32))/9
6 WAP to swap two numbers with and without using temporary variable
7 WAP to determine a given number is ‘odd’ or ‘even’ and print the following
message “Number is ODD” or
“Number is Even” (i) Without using else option. (ii) With else option
8 WAP to accept three numbers from user and Print Maximum number
9 WAP to print grade of a student using following rules :
Percentage >70 means Grade A
Percentage 60-70 means Grade B
Percentage 50-60 means Grade C
Percentage <50 means Grade F
10 WAP to perform addition, multiplication, subtraction and division with Switch
statement.
11 WAP that reads number from 1 to 7 and accordingly it should print
MONDAY to SUNDAY.
12 WAP to enter a character and check whether it is a vowel or consonant using
switch statement
13 WAP to check whether entered character is vowel or not.
14 WAP to display “Hello” five times.
15 WAP to display 1-10 numbers, 20-30 numbers
16 WAP to display multiplication table.
17 Assume that you want to make the sum of 1 to 100. Give the necessary
code to perform the same using (1) For loop (2) While loop (3) Do-while
loop
18 WAP for finding sum of 1 to k. The number k should be read from the
keyboard using command line argument.
19 WAP to print multiple of N from given range of integers. For example, if N=5
and range is [17, 45] it prints 20, 25, 30, 35, 40, 45. Take input using Scanner
class
20 WAP to find sum of all integers greater than 100 & less than 200 and are
divisible by 5.
21 WAP to count ODD and EVEN numbers from given 10 numbers
22 WAP to find the sum of first N odd numbers.
23 WAP to find 1+1/2+1/3+1/4+………+1/N series.
24 WAP to find 1+3/5+5/7+7/9+… series. Print addition of first N part.
25 WAP to find Factorial of a number.
26 WAP to generate Fibonacci series of numbers
27 WAP to reverse a number.
28 WAP to calculate sum of digits (Ex: 123 => so sum of digit = 1+2+3=6)
29 WAP to find out Armstrong Numbers. Example: - 153 is an Armstrong
Number.
30 WAP to check whether the given number is Prime or not. OR Write a C
program to find and print prime numbers between the numbers 1 to n,
where the number n should be read from the keyboard.
31 WAP to check whether a number is a perfect number or not. (e.g. 123 is a
perfect no i.e.1+2+3=1*2*3)
32 WAP to find out sum of first and last digit of a given number
33 WAP to print following pattern using loop statement for n row.
*
**
***
****
*****
1
13
135
1357
1
01
101
0101
1
23
456
7 8 9 10
*
##
***
####
*****
######
*******
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
*****
****
***
**
*
54321
4321
321
21
1
12345
2345
345
45
5
34 WAP to Print following pattern using loop statement for n row
*
* *
* * *
* * * *
1
A B
1 2 3
A B C D
1 2 3 4 5
1
A B
2 3 4
C D E F
5 6 7 8 9
1
2 2
3 3 3
4 4 4 4
1
123
12345
1234567
123456789