Practice Questions For Midterm Exam
Practice Questions For Midterm Exam
1. Tax Calculator
Write a program to calculate the sum of the first N even natural numbers:
Develop a program to compute the sum of the first N odd natural numbers:
Write a program to compute the sum of the first N NATURAL numbers in C using loop [1 + 2 + 3 + ...].
9. Sum of Squares
Create a program to calculate the sum of the squares of the first N numbers in C using loop [1² + 2² +
3² + ...].
• A perfect number is equal to the sum of its proper divisors (excluding itself).
• Example: 6 is perfect (1 + 2 + 3 = 6).