Header Ads

List Of All C Problems

Newly Updated

C Programs - HERE

Q27:Input two numbers. Ask user to enter a character +, -, * or / to choose the operation to perform among these numbers. Use switch statement to make a decision and, work and show result accordingly.

Q28:create a program that takes an alphabet as input and shows if it’s a vowel or not. Using while loop make sure that the input character is an alphabet. If not, ask user again to input character.

Q29:calculate percentage as long as the user wishes

Q30:print tables of first five natural numbers

Q31:Design a program that is capable of calculating total of five subjects marks, each of 100 marks. The program will run as long as the user wishes but will work once at least without asking user’s permission.

Q32:find maximum value in an array

Q33: Declare an array of char that holds vowels in small letters i.e.
                  char vowel[5] = {‘a’ , ‘e’ , ‘I’ , ‘o’ , ‘u’}
 Create a function named capitalized that takes two parameters, first is the above mentioned array and second its size. This function changes all vowels to upper case.
                 void capitalized (char arr[] , int size) 
Print array after capitalization

Note: Use #define constant to set size of the array

Q34: Write a program that creates emp.txt that contains 5 employee records. The data for each employee consist of :

  • the employee’s id ,
  • pay for the week,
  • 2% taxes deducted and
  • net pay for the week.

Take employee ids and pay input from the user. Tax and net pay will be calculated in the program. Then write this data to the file. Each record is a separate text line in file emp.txt. Followed by a blank line and write the information under each column heading. Your output will be some like:

Q1:Find the sum of three numbers

Q2:Take time in hour and convert it into seconds

Q3:Take quiz marks (out of 15) as input and find percentage

Q4:Design a program to assist in the design of a hydroelectric dam. Prompt the user for the height of the dam and for the number of cubic meters of water that are projected to flow from the top to the bottom of the dam each second. Predict how many megawatts (1MW=106W) of power will be produced if 90% of the work done on the water by gravity is converted to electrical energy. Note that the mass of one cubic meter of water is 1000kg. Use 9.80 meters/seconds as the gravitational constant g. The relevant formula (w=work, m=mass, g= gravity, h=height) is: W=mgh

Q5:Take computer file size in GB and display the size in bytes.

Q6:Write a program that calculates time to fill the tank if the tank already has some water. The initial and final readings of scale on the tank are used to calculate the total liters of water added. It takes 8 seconds to add one liter of water to the tank. Display time in minutes.

Q7:Find whether a letter a capital letter or small letter

Q8:An employee gets a yearly bonus only if his years of service are more than 3 years otherwise he gets no bonus. While years of service are more than 3 , bonus depends upon basic salary of employee. If salary is greater than or equals to 15000 than bonus is 20% of basic salary otherwise 15%.

Q9:Rock-paper-scissor game for 1 round only between player1 and player2

Q10:John needs a program to implement teacher’s discount policy. The program is to prompt the user to enter the purchase total and to indicate whether the purchaser is a teacher or not (y/n). If purchaser is not a teacher he/she will not get any discount. The store plans to give each customer a printer receipt, so your program is to create a nicely formatted output. Teachers receive a 13% discount on their purchases unless the purchase total is $100 or higher. The discount calculation occurs before addition of the 5% sales tax.

Q11:Take distance in km as input and display the distance in m.

Q12:Take time in hours as input and display the time in seconds.

Q13:Take distance in km and time in hours as input and display the speed in km/hr.

Q14:Take distance in km and time in hours as input and display the speed in m/s.

Q15:Take temperature in Centigrade as input and convert it into Kelvin i.e. K = C + 273

Q16:Take temperature in Fahrenheit as input and convert it into Centigrade i.e. C = 5*(F-32)/9

Q17:Take temperature in Fahrenheit as input and convert it into Kelvin.

Q18:Get the least significant digit (right-most) of a 3-digit number

Q19:Find out whether the input number is positive, negative or zero

Q20: Input four lengths a, b, c and d and find out whether they ‘can’ form a valid square. float distInKm float distInM CalculateKmToM

Q21:Two player guessing game

Q23:Consider the next problem. We want to ask user to enter numbers and keep adding them until the user presses -1. We assumed -1 to be the stopping value. When user presses -1, loop stops and program shows total sum.

Q24:calculate percentage as long as the user wishes

Q25:Program takes grade as input and comments according to it

Q26:Modified version of above Program that takes grade as input and comments according to it. Now it works for both capital and small case

No comments