PPS Assignment - 4: Test Case
PPS Assignment - 4: Test Case
1. Write a C program that calculates the sum of integers between 9 and 300 inclusive which
are divisible by 7 but not divisible by 63.
Test Case:
Sum of integers between 9 & 300 that are divisible by 7 but not by 63 is 5684
2. Write a C program that accepts an integer from keyboard and calculates the sum of digits
of an integer.
Test Case:
3. Write a C program that accepts a positive integer n less than 50 from the terminal and prints
out the sum 14 + 24 + 44 + 74 + 114 +· ·+ m4, where m is less than or equal to n. If the input is
outside the range, the program terminates
· with appropriate message.
Test Case:
4. Write a C program that asks the user to enter a positive integer n less than 10. If the user
enters an invalid input, the code repeats the command of asking the user for a positive integer
less than 10 until the input is correct. It then prints out the sum of the first n terms of the
series 14 + 24 + 44 + 74 + 114 + · · ·.
Test Case:
6. Write a C program that reads an integer n from the keyboard and prints out the factorial of
n.
Test Case:
Enter an integer:6
Factorial of 6 is 720
Enter an integer:-3
n must be non-negative
7. A perfect number is a positive number in which sum of all positive divisors excluding that
number is equal to that number. Write a C program that accepts a positive integer from the
keyboard and checks whether the entered number is a perfect number.
Test Case: