Professional Documents
Culture Documents
FUNDAMENTAL
1. Print your name and address.
2. Addition of two numbers.
3. Average of three numbers.
4. Find the area and the perimeter of a triangle.
5. Convert a Fahrenheit temperature into Celsius temperature.
6. Calculate V = U + FT
7. Find the roots of a Quadratic Equation.
CONDITION
1. Test whether an inputted no. is odd or even.
2. Find maximum of two nos.
3. Find the maximum of five inputted no.
4. Enter the sales value and calculate the commission.
Sales value Commission
Below 5000 5% of sales
Between 5000 to 10000 10% of sales (subject to minimum of 600 & maximum of 900)
More than 10000 25% of sales + Rs.100 incentive
5. Enter marks of five subjects and Calculate total marks and find out the grade of each student.
Total marks Grade
<120 F
<150 D
<210 C
<240 B
<270 A
>=270 O
6. Display all 2 digits number which are divisible 3 but not divisible by 9.
7. Given a 4 digit no. representing a year write a program to find out whether it is a leap year.
8. A program that will print different messages at different times of day. These are –
12 midnight to 12 noon - good morning!
12 noon to 6 p.m. - good evening!
6 p.m. to 12 midnight - good night!
else - time invalid!
TERNARY OPERATOR
1. Find out the largest value among three variables using TERNARY OPERATOR.
SWITCH-CASE
1. Using switch-case write a menu driven program-
*** MENU ***
Enter 1 for ADD
Enter 2 for SUBTRACTION
Enter 3 for MULTIPLICATION
Enter 4 for DIVISION
2. Write a program that will convert a positive integer to a Roman numerical (12-XII, 14-XIV etc.)
3. Write a program to check whether a inputted character is Vowel or Constant.
4. Write a program where a student has five subjects, find out the total marks and calculate the grade:
total>=60---1st div; total>=40---2nd div; total>=30 ---3rd div.
LOOP
1. Series print->1, 2, 3, 4, 5, 6,-----------.
2. Series print->2, 4, 6, 8, ------OR 1, 3, 5, 7, 9, -------.
3. Print the Fibonacci series: 0,1, 1, 2, 3, 5, 8, ---------------, n
4. WAP to Count the no. of digits (145=3).
5. WAP to Find out the Sum of Digits(145=10).
6. WAP to check a number is Armstrong no or not. (153=1^3+ 5^3+ 3^3)
7. WAP to check a number is Peterson/ Krishnamurthy no or not. (145=1!+ 4!+ 5!)
8. WAP to check a number is Palindrome or not.(121=121).
9. Factorial of any number (5=5!+4!+3!+2!+1!=120).
10. Check whether a no. is Prime or not.
11. Print Prime number between 1 to 100
SERIES:
1. Summation of Series: 1+2+3+4+........+n
2. Summation of Series: 1+3+5+7+9+.....+n
3. Summation of Series: 2+6+12+20+30+42........+(n+n^2)
4. Summation of Series: 0+1+1+2+3+5+8+13+.....+n
5. Summation of Series: 1/1!+2/2!+3/3!+4/4!+5/5!+.....+n/n!
6. Summation of Series: 1+12+123+1234+........+n
7. Summation of Series : 1+22+333+4444+........+n
8. Summation of Series: 1-x^2/2!+x^3/3!-x^4/4!.....(+/-)x^n/n!
9. Summation of Series: 1-x^2/2!+x^4/4!-x^6/6!.....(+/-)x^n/n!
PYRAMID:
1. Print the triangle:
*
* *
* * *
* * * *
* * * * *
2. Print the triangle:
* * * * *
* * * *
* * *
* *
*
3. Print the triangle:
*
* *
* * *
* * * *
* * * * *
4. Print the triangle:
* * * * *
* * * *
* * *
* *
*
5. Print the pyramid
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
* * * * * * *
* * * * *
* * *
*
6. Print the triangle:
1
1 2
1 2 3
1 2 3 4
7. Print the triangle:
1
2 3
4 5 6
7 8 9 10
8. Print the triangle:
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1