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

C Programming Exercises and Solutions

Uploaded by

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

C Programming Exercises and Solutions

Uploaded by

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

1. Write a program to reverse a given number using a while loop.

2. Write a program to count the number of digits in a given number using a while loop.

3. Write a program to calculate the factorial of a number using a do while loop.

4. Write a program to keep asking the user to enter numbers and stop only when the user
enters 0, then print the sum of all entered numbers.

5. Write a program to print a multiplication table from 1 to 10.


6. Write a C program to calculate the claim amount reimbursed by a health insurance company based on the following
conditions using if-else:

•Input from the user:

• Number of hospitalization days

• Type of hospital — enter 1 for Network hospital and 2 for Non-Network hospital

• Total hospital bill (₹)

•Rules:

• If the hospital is a Network hospital, the insurance reimburses 80% of the total bill.

• If the hospital is a Non-Network hospital, the insurance reimburses 60% of the total bill.

• If the number of hospitalization days is less than 3, no room rent reimbursement is allowed, so the claim is further
reduced by ₹2000 (deduct from reimbursable amount).

• The maximum reimbursement is ₹5,00,000 (cap the claim at 5 lakh).


7. Compute power xy (without using pow()), using a for loop.

[Link] a program to find the sum of diagonal elements of a square matrix.

9. Write a program to count the number of duplicate elements in an array.

10. Write a program to count positive, negative, and zero elements in an array.

You might also like