**Ask the user for her marks in ITC Midterm #1 (out of 62.5) and find out the percentage marks.**

__PROBLEM #1:____e.g. 1__

__Sample Input:__

**(Note: Bold refers to user input)**

Enter your marks in “ITC Midterm #1” :

*25*

__Sample Output:__Your marks as a percentage are :

*40.00 %*__e.g. 2__

__Sample Input:__

**(Note: Bold refers to user input)**

Enter your marks in “ITC Midterm #1” :

**6***2.5*

__Sample Output:__Your marks as a percentage are :

*100.00 %*------------------------------------------------------------------------------------------------------------------------------------------

**Our course outline assigns the following weight (percent) to each of the grading instruments:**

__PROBLEM #2:__ Instruments | Marks |

Final Exam | 50 |

Midterm Exams (2) (12.5 each) | 25 |

Assignments | 15 |

Quizzes | 6 |

Labs | 4 |

Now that you have sufficient knowledge of data types (int, char, float, double, etc.) and mathematical operators (+, -, /, *, etc.) in C, you are hired by the CS Department of FAST-NUCES to write a program in C that would calculate a student’s Final Percentage in a course that has the same marks distribution as shown in the table above.

__Sample Input:__**(Note: Bold refers to user input)**

Enter your marks in “Labs” (out of 80) :

*70*Enter your marks in “Quizzes” (out of 60):

*40*Enter your marks in “Assignments” (out of 150):

**135**Enter your marks in “Midterm #1” (out of 62.5):

*22.5*Enter your marks in “Midterm #2” (out of 62.5):

*62.5*Enter your marks in “Final Exam” (out of 100):

*87*

__Sample Output:__Final percentage = 81.5 %

------------------------------------------------------------------------------------------------------------------------------------------

**Take temperature in Fahrenheit as input and convert it into Centigrade and Kelvin. Display the conversion results at the end.**

__PROBLEM #3:__• Centigrade i.e. C = 5*(F-32)/9

• Kelvin i.e. K = C + 273

*.*

__Sample Input:__**(Note: Bold refers to user input)**

Enter Temperature in Fahrenheit :

*32*

__Sample Output:__Centigrade :

*0.00*°*C*Kelvin :

*273.00 K***Note: The character**

**‘°’**

**should also be printed in the output.**

**Prompt the user for the diameter of a circle in centimeters and find out its area in square meters.**

__PROBLEM #4:__

__Sample Input:__**(Note: Bold refers to user input)**

Enter Diameter :

*200*

__Sample Output:__Area :

*3.142 square meters*------------------------------------------------------------------------------------------------------------------------------------------

**Input a real number from the user and round it.**

__PROBLEM #5:__**Note: You are**

__NOT__allowed to use__if statements__or__any C library__, e.g. math.h, etc.**Hint: Casting!**

__e.g. 1__

__Sample Input:__**(Note: Bold refers to user input)**

Enter a real number:

*2.44*

__Sample Output:__This number rounds to:

*2.00*__e.g. 2__

__Sample Input:__**(Note: Bold refers to user input)**

Enter a real number:

**5.723**

__Sample Output:__This number rounds to: 6.00

**Input two characters**

__PROBLEM #6:__**char1**and

**char2**and interchange their values i.e. swap.

__Sample Input:__**(Note: Bold refers to user input)**

Enter char1:

**A**Enter char2:

**B**

__Sample Output:__char1 = ‘B’

char2 = ‘A’

**Note: The character output should be enclosed within single quotes i.e. ‘’ as shown.**

**If a five-digit number is input through the keyboard, write a program to calculate the sum of its digits.**

__PROBLEM #7:__**(Hint: Use the remainder operator i.e. %)**

__Sample Input:__**(Note: Bold refers to user input)**

Enter a five-digit number:

**54321**

__Sample Output:__Sum of digits: 15

**The cashier at the counter of a Super Store, Mr. Khazaanchi has the following bundles of rupee cash notes with him:**

__PROBLEM #8:__Rs. 1, 2, 5, 10, 50, 100, 500, 1000

A customer comes at his counter with various items that he has shopped. Mr. Khazaanchi totals the item prices and tells the customer his total amount payable. The customer gives Mr. Khazanchi some amount of cash. Find the total number of rupee notes of each denomination (i.e. 1, 2, 5, 10, 50, 100, 500, 1000) Mr. Khazaanchi will have to give to the withdrawer ensuring that the total number of rupee notes are

**.**__minimum____e.g. 1__

__Sample Input:__**(Note: Bold refers to user input)**

Total Bill:

**2534**Customer pays:

**2600**

__Sample Output:__Rs. 1 Notes: 1

Rs.2 Notes: 0

Rs. 5 Notes: 1

Rs. 10 Notes: 1

Rs. 50 Notes: 1

Rs. 100 Notes: 0

Rs. 500 Notes: 0

Rs. 1000 Notes: 0

Total Number of Rupee Notes = 4

__e.g. 2__

__Sample Input:__**(Note: Bold refers to user input)**

Total Bill:

**2534**Customer pays:

**5000**

__Sample Output:__Rs. 1 Notes: 1

Rs.2 Notes: 0

Rs. 5 Notes: 1

Rs. 10 Notes: 1

Rs. 50 Notes: 1

Rs. 100 Notes: 4

Rs. 500 Notes: 0

Rs. 1000 Notes: 2

Total Number of Rupee Notes = 10

__e.g. 3__

__Sample Input:__**(Note: Bold refers to user input)**

Total Bill:

**2534**Customer pays:

**5034**

__Sample Output:__Rs. 1 Notes: 0

Rs.2 Notes: 0

Rs. 5 Notes: 0

Rs. 10 Notes: 0

Rs. 50 Notes: 0

Rs. 100 Notes: 0

Rs. 500 Notes: 1

Rs. 1000 Notes: 2

Total Number of Rupee Notes = 3

1) If cost price and selling price of an item is input through the keyboard, write a program to determine whether the seller has made profit or incurred loss. Also determine how much profit he made or loss he incurred.

2) Any integer is input through the keyboard. Write a program to find out whether it is an odd number or even number.

3) A five-digit number is entered through the keyboard. Write a program to obtain the reversed number and to determine whether the original and reversed numbers are equal or not.

4) If the ages of Ram, Shyam and Ajay are input through the keyboard, write a program to determine the youngest of the three.

5) Write a program to check whether a triangle is valid or not, when the three angles of the triangle are entered through the keyboard. A triangle is valid if the sum of all the three angles is equal to 180 degrees.

6) Find the absolute value of a number entered through the keyboard.

7) Given the length and breadth of a rectangle, write a program to find whether the area of the rectangle is greater than its perimeter. For example, the area of the rectangle with length = 5 and breadth = 4 is greater than its perimeter.

8) A certain grade of steel is graded according to the following conditions:

(i) Hardness must be greater than 50

(ii) Carbon content must be less than 0.7

(iii) Tensile strength must be greater than 5600

The grades are as follows:

Grade is 10 if all three conditions are met

Grade is 9 if conditions (i) and (ii) are met

Grade is 8 if conditions (ii) and (iii) are met

Grade is 7 if conditions (i) and (iii) are met

Grade is 6 if only one condition is met

Grade is 5 if none of the conditions are met

Write a program, which will require the user to give values of hardness, carbon content and tensile strength of the steel under consideration and output the grade of the steel.

9) A library charges a fine for every book returned late. For first 5 days the fine is 50 paisas, for 6-10 days fine is one rupee and above 10 days fine is 5 rupees. If you return the book after 30 days your membership will be cancelled. Write a program to accept the number of days the member is late to return the book and display the fine or the appropriate message.

10) If the three sides of a triangle are entered through the keyboard, write a program to check whether the triangle is valid or not. The triangle is valid if the sum of two sides is greater than the largest of the three sides.

11) If the three sides of a triangle are entered through the keyboard, write a program to check whether the triangle is isosceles, equilateral, scalene or right angled triangle.

12) In a company, worker efficiency is determined on the basis of the time required for a worker to complete a particular job. If the time taken by the worker is between 2 – 3 hours, then the worker is said to be highly efficient. If the time required by the worker is between 3 – 4 hours, then the worker is ordered to improve speed. If the time taken is between 4 – 5 hours, the worker is given training to improve his speed, and if the time taken by the worker is more than 5 hours, then the worker has to leave the company. If the time taken by the worker is input through the keyboard, find the efficiency of the worker.

13) A university has the following rules for a student to qualify for a degree with A as the main subject and B as the subsidiary subject:

(a) He should get 55 percent or more in A and 45 percent or more in B.

(b) If he gets less than 55 percent in A he should get 55 percent or more in B. However, he should get at least 45 percent in A.

(c) If he gets less than 45 percent in B and 65 percent or more in A he is allowed to reappear in an examination in B to qualify.

(d) In all other cases he is declared to have failed.

Write a program to receive marks in A and B and Output whether the student has passed, failed or is allowed to reappear in B. 1. Input an alphabet (e.g. ‘a’, ‘b, ‘c’, ‘x’, ‘y’, ‘z’) and display whether the input alphabet is a vowel (i.e. a, e, i, o, u) or not.

2. Print first 10 odd numbers in ascending order.

3. Take as input three numbers and print those numbers in descending order.

4. Read the Salary of an employee and make the following deductions before printing it out:

a. If salary is less than or equal to 10,000 then no deduction are done.

b. If salary is more than 10,000 and less than 25,000 then deduct Rs. 1,000.

c. If salary is equal to or more than 25,000 then deduct 5 % of the salary.

d. Test with salary=25,000 and 10,000.

5. Display all numbers between A and B (excluding A and B), where A and B are whole numbers and taken as input from the user. (Hint: if A is greater than B you will need a swap). Test with A=5 and B=10, then A=15 and B=7.

6. Find out whether the input number is even or odd and if the number is even, display its square and if the number is odd display the cube.

7. Take n numbers as input and print whether the number is even or odd.

8. Read a number N and print all its divisors. (Divisor of N will be a number which divides N without leaving a remainder, for example, the set of divisors of 60 are {1,2,3,4,5,6,10,12,15,20,30,60})

9. Take as input the number of hours worked by 10 employees and output their overtime pay. Overtime is paid at the rate of Rs. 12.00 per hour for every hour worked above 40 hours. Assume that employees do not work for fractional part of an hour.

10. Write a program to find the factorial value of any number entered through the keyboard using for loop.

11. Write a program to find the factorial value of any number entered through the keyboard using while loop

12. Two numbers are entered through the keyboard. Write a program to find the value of one number raised to the power of another. (do it first using for loop and then using while loop)

13. Write a program to print all the ASCII values and their equivalent characters using a

**while**loop. The ASCII values vary from 0 to 255.14. Write a program to print out all Armstrong numbers between 1 and 500. If sum of cubes of each digit of the number is equal to the number itself, then the number is called an Armstrong number. For example, 153 = ( 1 * 1 * 1 ) + ( 5 * 5 * 5 ) + ( 3 * 3 * 3 )

15. Write a program to enter the numbers till the user wants and at the end it should display the count of positive, negative and zeros entered.

16. Write a program to find the octal equivalent of the entered number.

17. Write a program to find the range of a set of numbers. Range is the difference between the smallest and biggest number in the list.

18. Write a program to print all prime numbers from 1 to 300. (Hint: Use nested loops,

**break**and**continue**)19. Write a program to print the multiplication table of the number entered by the user. The table should get displayed in the following form.

29 * 1 = 29

29 * 2 = 58

20. Write programs to print the following output using nested loops

21. Ask the user for his/her age and display the message according to the following:

If age is less than 16, display "You can't drive."

age is less than 18, display "You can't vote."

age is less than 25, display "You can't rent a car."

age is 25 or over, display "You can do anything that's legal.".

Test with age=16 and 25

(Note: if age is < 16, first three messages will get displayed)

1. Twenty-five numbers are entered from the keyboard into an array. The number to be searched is entered through the keyboard by the user. Write a program to find if the number to be searched is present in the array and if it is present, display the number of times it appears in the array.

2. Twenty-five numbers are entered from the keyboard into an array. Write a program to find out how many of them are positive, how many are negative, how many are even and how many odd.

3. Implement the Bubble Sort algorithm on a set of 25 numbers input by the user.

4. Write a program to pick up the largest number from any 5 row by 5 column matrix.

5. Twenty-five numbers are entered from the keyboard into an array. Write a program to find out

a. Mean (Average)

b. Median

i. Number in middle of sorted list for e.g. in case of 1, 2, 3, 4, 5 (3 is median), If even number of elements, take average of middle two

c. Mode:

i. Number that occurs most often for e.g. in case of 1, 1, 1, 2, 3, 3, 4, 5 (1 is mode)

6. Write a program to find the octal equivalent of the entered number.

7. Take as input a 4x4 matrix from the user:

a. Write a program to obtain transpose of the matrix. The transpose of a matrix is obtained by exchanging the elements of each row with the elements of the corresponding column.

b. Write a program to find if the input square matrix is symmetric. (In linear algebra, a symmetric matrix is a square matrix that is equal to its transpose.)