0% found this document useful (0 votes)
39 views3 pages

Loop Assignments

Uploaded by

ak4360129
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)
39 views3 pages

Loop Assignments

Uploaded by

ak4360129
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
You are on page 1/ 3

1. 1.

Given an exam marks as input, display the appropriate message based on the
rules below:
If marks is greater than 49, display “PASS”, otherwise display “FAIL”. However, for
input outside the 0-100 range, display “WRONG INPUT” and prompt the user to input
again until a valid input is entered.
2. print the list of N natural number.
Expected Output :
1 2 3 4 5 6 7 8 9 10
3. Take an weight continiously and print it until weight is less than 65.
4. Print the sum of N natural number and sum of square of N natural number using
for and while both.
Expected Output :
The first 10 natural number is :
1 2 3 4 5 6 7 8 9 10
The Sum is : 55
5. Compute and print the GCD of two number.
6. Find the number of month to double your money and print it. If money is
increasing 2% in each month.
7. Maximum of positive number infinitely using while loop. And stop the loop using
negative number.
8. Find the sum of all digits of a number.
9. Find the factorial using loop.
10. Convert decimal to binary.
11. Check a number is prime or not and print the result.
12. Write a program in C to read 10 numbers from the keyboard and find their sum
and average.
Test Data :
Input the 10 numbers :
13. Write a program in C to display the multiplication table for a given integer.
Test Data :
Input the number (Table to be calculated) : 15
Expected Output :
15 X 1 = 15
...
...
15 X 10 = 150
14. Write a C program to display the n terms of odd natural numbers and their sum.
Test Data
Input number of terms : 10
Expected Output :
The odd numbers are :1 3 5 7 9 11 13 15 17 19
The Sum of odd Natural Number upto 10 terms : 100
15. Write a program in C to display a pattern like a right angle triangle using an
asterisk.
The pattern like :
*
**
***
****

16. Write a C program to display a pattern like a right angle triangle with a number.
The pattern like :
1
12
123
1234

17. Write a program in C to make such a pattern like a right angle triangle with a number
which will repeat a number in a row.

The pattern like :


1
22
333
4444

18. Write a program in C to make such a pattern like a right angle triangle with the number
increased by 1.

The pattern like :


1
2 3
4 5 6
7 8 9 10

19. Write a program in C to make a pyramid pattern with numbers increased by 1.

1
2 3
4 5 6
7 8 9 10

20. Write a C program to make such a pattern as a pyramid with an asterisk.

*
* *
* * *
* * * *

21. Write a C program to display the sum of n terms of even natural


numbers.
Test Data :
Input number of terms : 5
Expected Output :
The even numbers are :2 4 6 8 10
The Sum of even Natural Number upto 5 terms : 30

You might also like