[Go to site: main page, start]

0% found this document useful (0 votes)
11 views1 page

Essential Conditional & Looping Programs

The document outlines a series of programming exercises focused on conditional statements and loops. It includes tasks such as finding the greatest number, checking for even or odd numbers, calculating grades based on percentages, and generating various numerical series. Each task is designed to enhance programming skills through practical applications of logic and arithmetic.

Uploaded by

tusimistune87
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

Essential Conditional & Looping Programs

The document outlines a series of programming exercises focused on conditional statements and loops. It includes tasks such as finding the greatest number, checking for even or odd numbers, calculating grades based on percentages, and generating various numerical series. Each task is designed to enhance programming skills through practical applications of logic and arithmetic.

Uploaded by

tusimistune87
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Conditional & Looping Programs

1. Write a program that takes three numbers from the user and prints the greatest number.
2. Write a program to check whether a number is even or odd
3. Write a program to get a number from the user and print whether it is positive or negative.
4. Write a program to check whether a number is divisible by 5 and 11 or not
5. Write a program that takes a number from the user and generates an integer between 1 and 7. It displays the weekday
name.
6. Write a program to find the number of days in a month.
7. Write a program that takes a year from the user and prints whether it is a leap year or not.
8. Write a program to input the angles of a triangle and check whether the triangle is valid or not
9. Write a program to check whether the triangle is equilateral, isosceles, or scalene triangle.
10. Write a program to calculate profit or loss.
11. Write a program to check whether a character is an alphabet or not
12. Write a program to input any alphabet and check whether it is a vowel or consonant
13. Write a program to check whether a character is uppercase or lowercase alphabet
14. Write a program to input marks for five subjects Physics, Chemistry, Biology, Mathematics, and Computer. Calculate
the percentage and grade according to the following:
Percentage >= 90% : Grade A
Percentage >= 80% : Grade B
Percentage >= 70% : Grade C
Percentage >= 60% : Grade D
Percentage >= 40% : Grade E
Percentage < 40% : Grade F

15. Write a program to input basic salary of an employee and calculate its Gross salary according to the following:
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary <= 20000 : HRA = 25%, DA = 90%
Basic Salary > 20000 : HRA = 30%, DA = 95%
16. Write a program to input electricity unit charges and calculate the total electricity bill according to the given condition:
For first 50 units Rs. 0.50/unit
For next 150 units Rs. 0.75/unit
For next 250 units Rs. 1.20/unit
For unit above 250 Rs. 1.50/unit
• An additional surcharge of 20% is added to the bill

17. Write a program to find the sum of the 1st 10 odd natural numbers.
18. Write a program to find the sum of the 1st 10 even natural numbers.
19. Write a program to find the sum of all 3-digit even natural numbers.
20. Write a program to find the sum of all 3-digit odd natural numbers, which are multiples of 5.
21. Write a program to input an integer and find its factorial. The Factorial of a number is the product of all natural numbers
to that number.
For example, the factorial of 5 is 120 since 1X2X3X4X5 =120.
22. Write a program to input an integer and count the number of factors.
23. Write a program to input an integer and check whether it is a prime number or not.
A prime number is such a number that has 2 factors only.
24. Write a program to input 10 integers and find their sum.
25. Write a program to input 10 integers and find the sum of the even numbers only.
26. Write a program to input IO integers and find the sum of 2-digit as well as 3-digit numbers separately
27. Write a program to find the sum of the 1st 10 numbers of the Fibonacci series.
i.e. 1, 1, 2, 3, 5, 8, 13... Fibonacci series is a series that starts from 0 and 1, and subsequent numbers are the sum of
the previous two numbers.
28. Write a program to print the first 15 numbers of the Pell series. Pell series is such a series that Starts from 1 and 2, and
subsequent numbers are the sum of twice the previous number and the number previous to the previous number. Pell
series: 1, 2, 5, 12, 29, 70, 169, 408, 985, 2378, 5741, 13860, ...
29. Write a program to find the sum of the 1st 10 numbers of the Lucas series i.e. Fibonacci series is such a series that
starts from 2 and 1, and subsequent numbers are the sum of the previous two numbers.
30. Write a program to input 10 numbers and print the smallest number.

You might also like