Вы находитесь на странице: 1из 3

Simple Programs 1. Write a program in C to print your personal details (name, age, date of birth, address, qualification etc...

) in a neat format using printf statement. 2. Write a program in C to find area of a cube and area of a cylinder. 3. Write a program in C to find the simple interest by getting principle amount, rate of interest and years as a input. SI = P*N*R/100.0 4. Write a program to find the average mark scored by a student in 5 subjects entered as a input. 5. Write a program in C to find the overall percentage of educated people in a city. Give input as total number of male, female people and total number of educated male, female people. 6. Write a program in C to convert your height in meters to feet, centimeter. 7. Write a program in C to SWAP the contents of 2 variables using third variable and also without using the temporary (or extra) variables. 8. Write a C Program to input any ASCII number and display appropriate character on screen and vice-versa. 9. Write a program to calculate the roots of a given quadratic equation ax 2 + bx + c = 0 using the following formula. Root 1 = (-b + square_root_of(b2 4ac)) / (2*a) Root 2 = (-b - square_root_of(b2 4ac)) / (2*a) If statements 10. Write a program in C to find the biggest and smallest among 3 given numbers. 11. Admission to a professional courses is subject to the following conditions: a. Marks in Mathematics >=60 b. Marks in Physics >=50 c. Marks in Chemistry >=40 d. Total in all three subjects >=200 (or) Total in Mathematics and Physics >=150 Write a program in C to check whether a particular students mark is eligible for admission or not. 12. Write a program in C to find whether a given number is odd number or even number. 13. Write a program to calculate electricity bill of a user. Minimum amount to be paid Rs.50. For every units between 0 100, Re.1 per unit will be charged. For every unit between 101 200, Rs.2 per unit will be charged. For every unit between 201 300, Rs.3 per unit will be charged. For units above 300, Rs.4 will be charged. 14. An organization uses the following rule to give DA (Dearness allowance) to its employees. If employee experience is above 20 years, then DA is 20% of their basic salary. If employee experience is between10-19 years, then DA is 10% of their basic salary. For all other cases it will be 5%. Give input as the no of years and basic salary. Calculate total salary by the above rule. Switch Case

15. Write a program in C displaying a menu with options CIRCLE, SQUARE, RECTANGLE, TRIANGLE and EXIT. Get the appropriate input from the user for calculating the AREA of the chosen option. For example if CIRCLE is chosen then get only r (radius) as input and calculate the Area of the circle. 16. Write a program to find the vehicle insurance as per the following rule. Give the input as a vehicle type. a. For car, Rs. 10,000 per year b. For Two-Wheelers, Rs. 1000 per year c. For Bus, Lorry, Rs.15,000 per year. 17. Write a program in C, to give grade to the students according to their mark. a. If mark is above 90, grade O. b. If 80-89, grade A c. If 70-79, grade B d. If 60-69, grade C e. Below 60, grade F Looping 18. Write a program in C to calculate the sum of first n natural numbers.
19. Write a program in C to find whether a given number is a prime or not. 20. Write a program in C to find a factorial of a given number.

21. Given an integer n such as 1367. Write a program that finds the inverse of this integer as 7631 and also the double of the inverse 15262. 22. Write a program to print the pyramid of nos. 1 234 56789 23. Write a program in C to calculate the value of the following series using any of the looping statements (for or while or do-while). Sum = 1 1/2 + 1/3 1/4 + 1/5 - --- + 1/n. Get the values of n using scanf function and calculate the sum. 24. Write a program in C that reads integer values x & y, and find the value of x to the power y without using math library 25. Write a C program to read in two numbers, x and n, and then compute the sum of following geometric progression using any of the looping statements (for or while or dowhile). G.P = 1 + x + x2 + x3 + . + xn For example: If n is 3 and x is 5, then the program computes 1+5+25+125. 26. Write a program that allows any positive number to be typed in. The program should count how many times the number has to be doubled before it reaches 1 lakh. 27. Write a program in C to calculate the value of the following series using any of the looping statements (for or while or do-while). Sum = 11 + 22 + 33 + 44 + + nn

Arrays 28. There are two arrays (say A[0],A[1],A[2], and B[0],B[1],B[2],). Do the following tasks a. Copy all the elements in the array A to another array C b. Find the sum of array A and B, store it to another array D. c. Reverse the elements of array B, store it in array E. 29. Write a program in that reads two sets A and B in an array, and perform the following operations. a. C=AUB (Union) b. D=AB (Intersection) c. E=A-B (Compliment) 30. Write a program in C to perform multiplication of two matrices A and B. Matrices A and B should be declared as a two dimensional integer array. Use any one the looping statements (for or while or do-while). Input Matrix A row m1 Matrix A column n1 Matrix B row m2 Matrix B column n2 Matrix As elements (m1 n1 elements) Matrix Bs elements (m2 n2 elements) Output Matrix C (Multiplication of A and B) 31. Write a program in C to find whether a given string is palindrome or not. 32. Write a program in C that reads n numbers. Find the sum of all odd numbers and sum of all even numbers. Input n (How many numbers) n array elements (say a[0], a[1], a[2], .a[n]) Output Even numbers sum Odd numbers sum

Вам также может понравиться