Program based upon variables declaration and initialization
- Create a program to declare and initialize variables for given formulas and also print them.
- Circle
- area= πr2
- perimeter = 2*π*r
- Square
- area= side * side
- perimeter = 4*side
- Rectangle
- area= length * width
- perimeter= 2*(length + width)
- Right angle triangle
- area= (base*height)/2
- perimeter= side1+side2+side3
- Volume
- Cube
- v=a3
- Cylinder
- v=b*h
- Cone
- v= b*h/3
- Sphere
- v=4πr3
- Cube
- Circle
- Swap two number using third variable.
- Swap two number without using third variable.
- Find of number of rupees note of 2000, 500, 200 in given amount.
- Program to calculate simple interest.
- Check number is even or odd.
- Check person is eligible for vote or not.
- Check two number are equal or not.
- Find out largest number in given two number.
- Check given year is leap year or not.
- Check given number is divided by 5 or not.
- Check given number is divided by 5 or 7.
- Check given number is divided by 11 and 17.
- Check two variables are not equal.
- Display name of days corresponding digit 1-7.
- Display name of months corresponding digit 1-12.
- Check student is pass or not in given three subject marks, where passing marks must be greater than 33.
- Find out grade of student in 10th class.
- A - where % is greater than 90
- B - where % is greater than 80
- C - where % is greater than 70
- D - where % is greater than or equal 60
- E - where % is less than 60
- Calculate addition, subtraction, multiplication and division by selecting choices from 1-4 using switch statement.
- Check number is even or odd using conditional statement.
- Find out largest number is given three number.
For loop programs
- Display numbers for given range.
- 1 to 100
- 100 to 1
- -10 to 10
- 10 to -10
- -10 to -20
- Display only even numbers in given range (1-100)
- Display only odd numbers in given range(32 - 64)
- Program to count, calculate sum and multiplication in given range(1-7)
- Check number is prime or not.
- Find out factorial of given number.
- Display table of a given number.
while loop programs
- Display numbers for given range.
- 1 to 100
- 100 to 1
- -10 to 10
- 10 to -10
- -10 to -20
- Display only even numbers in given range (1-100)
- Display only odd numbers in given range(32 - 64)
- Program to count, calculate sum and multiplication in given range(1-7)
- Check number is prime or not.
- Find out factorial of given number.
- Display table of a given number.
- Display digits of a given number.
- Count, calculate sum and multiplication of digits available in given number.
- Check number is palimdrome number(11, 121, 1221) of not.
- Check number is armstrong number(1, 153) or not.
- Check number is special number (1, 145) or not.
do-while loop programs
- Display numbers for given range.
- 1 to 100
- 100 to 1
- -10 to 10
- 10 to -10
- -10 to -20
- Display only even numbers in given range (1-100)
- Display only odd numbers in given range(32 - 64)
- Program to count, calculate sum and multiplication in given range(1-7)
- Check number is prime or not.
- Find out factorial of given number.
- Display table of a given number.
Nested loop programs
- Display all prime numbers from 1 to 100.
- Display table of numbers from 1 to 10.
Pattern Programs(Nested loop programs)
111 222 333
123 123 123
666 666 666
123 456 789
987 654 321
**** **** **** ****
* ** *** ****
**** *** ** *
* ** *** ****
**** *** ** *
* *** ***** *******
******* ***** *** *
Program based upon arrays
- Store given numbers in an array and print them, 45, 7 , 0, 90, -90, 89, 34, -45, 60
- Calculate count, sum of given array numbers 45, 7 , 0, 90, -90, 89, 34, -45, 60.
- Print only even numbers of given array 45, 7 , 0, 90, 91, 41, 80, -90, 89, 34, -45, 60.
- Print only numbers that are divided by 5 from given array 45, 7 , 0, 90, 91, 41, 80, -90, 89, 34, -45, 60.
- Print only numbers that are divided by both 5 and 11 from given array 45, 7 , 0, 90, 91, 41, 80, -90, 89, 34, -45, 60.
- Print only numbers that are special number from given array 45, 7 , 0, 90, 91, 41, 145, 80, -90, 89, 34, -45, 60.
- Print only numbers that are palimdrome number from given array 45, 7 , 0, 90, 91, 41, 80, -90, 89, 34, -45, 60, 11.
- Print only numbers that are armstrong number from given array 45, 7 , 0, 90, 91, 41, 1,80, -90, 89, 34, -45, 60, 153.
- Find position and index of 8 in given array 91, 41, 145, 80, -90,8, 90, 91.
- Find mode of 10 in given array 45, 7 , 10, 90, 91, 41, 145, 80, 10, 89, 34, -45, 10
- Find average of numbers given in an array 7 , 0, 90, 91, 41, 145, 80, -90.
- Store and display given array
1 0 0
0 1 0
0 0 1 - Store and display given array
10 20 30 40
50 60 70 80 - Display only first row numbers of given array
1 5 0
6 1 2
9 0 8 - Display only second row numbers of given array
1 5 0
6 1 2
9 0 8 - Display only third row numbers of given array
1 5 0
6 1 2
9 0 8 - Display only first column numbers of given array
1 5 0
6 1 2
9 0 8 - Display only second column numbers of given array
1 5 0
6 1 2
9 0 8 - Display only third column numbers of given array
1 5 0
6 1 2
9 0 8 - Display only left diagonal numbers of given array i.e {1, 1, 8}
1 5 0
6 1 2
9 0 8 - Display only right diagonal numbers of given array i.e {0, 1, 9}
1 5 0
6 1 2
9 0 8 - Calculate sum of given two array
1 5
6 1
1 2
9 0 - Subtract first array from second array.
1 5
6 1
1 2
9 0 - Transpose given array
1 2
9 0
1 9
2 0
Program based upon basic methods.
- Create a function that displays the user name.
- Create a function that checks number is even or odd.
- Create a function that adds prefix '0' on a single-digit number using parameterized function.
- Create a function that calculates the sum of two numbers using non parameterized function.
- Create a function that displays a number from 1 to 10 with the help of a while loop.
- Create a function that returns a greater number.
- Create a function that return even number for all the given array numbers {1, 45, 5, 6, 68, 90, 102, 0, 90}
Program based upon the class member variable and methods.
- Create a program where declare a method that contain three local variable named as
- String username
- double rate_of_interest
- double interest
Accept values from the user and store in the given variables and print them.
Note: Call the method without class object.
- Create a program that has method and calculating to swap two numbers using third variable.
Note: Call the method using class object.
- Create a program for given scene.
- Member variable
- String first_name
- String last_name
- int age
- String address
- Member methods
- input()
- display()
- Member variable
- Create a program for given scene.
- Member variable
- counter=0
- Member method
- increment(): increasing counter value by 100
- decrement(): decreasing counter value by 50
- display(): Displaying counter value
- Member variable
- WAP to calculate simple interest, accept input values in double and calculate with the integer values using type casting.
- WAP to calculate area of square, circle, triangle, rectangle with the function name "area" using method overloading.
- WAP for the given scene.
- Class Name: Person
- Member variable:
- String name
- int age
- String address
- String gender
- Member methods:
- Person(): Constructor to initialize object with the given values.
- name=""
- age=18
- address="almora"
- gender="male"
- Person(): Constructor to initialize object with the given values.
- input()
- display()
- WAP to check number is palimdrome or not with the use of Exception handling.