C Programming Exercises For Beginners:The below are the useful c programming exercises for beginners to learn and practice c programming. All the exercises are in a beginner level and are useful to practice c programming language.
C Programming Exercise 1:Write a c program to calculate the sum of squares of first n natural numbers using while loop. declare a variable n and read a value at run time and find the sum of squares of natural numbers upto the value of n.
C Programming Exercise 2:write a c program to read hours and minutes and convert hours to minutes, minutes to seconds. declare variable hours to read hours and convert them to minutes. declare variable minutes to read minutes and convert them to seconds.
C Programming Exercise 3:An electric power distribution company charges its domestic consumers as follows.
Consumption Units Rate of Charge
0-200 Rs.0.50 per unit
201-400 Rs.100 plus Rs.0.65 per unit excess 200
401-600 Rs.230 plus Rs.0.80 per unit excess of 400.
Write a C program that reads the customer number and power consumed and prints the amount to be paid by the customer.
C Programming Exercise 4:A number is special if it is exactly divisible by 15. A number is big if it is greater than 999. A number is weird if it is exactly divisible by 5 and 6 but not 18. A number is scary if it is big or weird. Write a c program to check which of the following, 450, 540, 600, and 675 are special but not scary. Declare four variables called special, big, weird, and scary and make suitable assignments to these variables as a number is tested.
C Programming Exercise 5:Consider an array X (type float) of length n. Write a C program to print the array Y, which is in reverse order of x. if x contains 1.2 2.2 3.2 4.2 5.2, then y should have 5.2 4.2 3.2 2.2 1.2
C Programming Exercise 6:if there are two arrays x and y. then create a new array z and store all the elements in the array x and array y in array z. the final array z should contain all the elements available in both arrays x and y.
C Programming Exercise 7:write a c program to print the transpose matrix of a given matrix
C Programming Exercise 8:Write a function to swap two variables using pointers. Take two variables of any data type and swap them by using pointer variables.
C Programming Exercise 9:Write a c program to calculate sum of two numbers using pointers to functions. create a new function and pass the memory addresses as arguments and find the sum of the given two variables and return the calculated sum value by using a pointer variable.
C Programming Exercise 10:write a c function with a return type as void and it should take n numbers into an array and find the maximum, minimum and sum of the elements in the array using pointer variables.
C Programming Exercise 11:Write a program that will stores the personal information of a student (such as name, date of birth, address) in a structure that you will define and then prints the record on the screen. A table of characters can be defined using pointers such as char *myline.
C Programming Exercise 12:Write a program to calculate and print student wise total marks for 50 students and 3 subjects. The structure should contain 3 subjects and total.
C Programming Exercise 13:Define a structure to represent a data. Use your structures that accept two different dates in the format mmdd of the same year. And do the following: Write a C program to display the month names of both dates.
C Programming Exercise 14:Define a structure that represent a complex number (contains two floating point members, called real and imaginary). Write functions to add, subtract, multiply and divide two complex numbers.
C Programming Exercise 15:write a Program to add or delete a record of a particular employee based on his code(id number). The structure should contain name, designation, code, salary. Program should also provide the flexibility to update any employees record.
C Programming Exercise 16:Write a C program to compute the monthly pay of 100 employees using each employee’s name, basic-pay. The DA is computed as 52% of the basic pay. Gross-salary (Basic-pay+DA).Print the employees name and gross salary.
C Programming Exercise 17:Consider a structure master include the information like name, code, pay, experience write a program to delete and display the information contained in master variables for a given code.
C Programming Exercise 18:A company markets Hardware items. Create a structure “hwitem” that stores the title of the item, it’s price, an array of three floats so that it can record the sale in rupees of a particular item for the last three months, category of the item and it’s original equipment manufacturer. Write a short program that provides facility to read N number of items information, append new item, and displays all records.
Conclusion:All the above mentioned C programming Exercises are to practice and understand the concepts in programming. If you have any doubts, please ask it in comments below. Please share this article. I hope the above c programming exercises are useful for you to practice. If you have any doubts, then share them in the comments below. Thank you for reading.
We Will Send Some More Information For Free!