You are on page 1of 5

1. WAP that takes a character from user and displays it again on the screen. 2.

WAP that displays My name is 3. WAP for addition of two numbers (simple). 4. Write a program that deliberately makes the following mistakes: a. Prints a floating-point number using the %d conversion. b. Prints an integer using the %f conversion. c. Prints a character using the %d conversion. 5. Write a program to accept two integers form the user in a and b. Add them and store the result in another variable result c. Display the result. 6. WAP to scan two numbers from user and display their addition, subtraction, multiplication, division & modulus. 7. WAP that scans temperature in degree Celsius and converts it to equivalent value in degree Fahrenheit. (F = (9/5)* C +32) 8. WAP that scans temperature in degree Fahrenheit and converts it to equivalent value in degree Celsius. 9. WAP to scan any character from user and display its ASCII Values. 10. Write a program to accept principal amount (p), number of years (n) and rate of interest (i) from the user. Calculate and display simple interest(si) and compound interest(ci). 11. Write a program to accept a radius of a circle in r and determine its area (a) and circumference(c). 12. Write a program to compute the area and perimeter of a rectangle with a width of three inches and a height of five inches. What changes must be made to the program so that it works for a rectangle with a width of 6.8 inches and a length of 2.3 inches? 13. Write a program to calculate the volume of a sphere. 14. WAP that scans name of a person and displays Hello. 15. Write a program to display your name on the monitor. 16. Modify the program to display your address and phone number on separate lines by adding two additional printf( ) statements. 17. WAP that accepts Name, Roll Number and Percentage of two students and display them in following manner. Name Roll No. Percentage _______ _______ _______ _______ _______ _______ Note: To scan Names gets( ) should be used instead of scanf( ).

Control Structures:
1. 2. 3. 4. IF ( ) Scan a number from user and display whether it is even or odd. Scan a number and display whether it is positive or negative. Scan a number and display its absolute value. Scan two numbers and display the larger of two numbers.

IF ( ) ELSE 5. WAP that declares two variables even_no and odd_no. Scan two numbers from user and store the even no. in even_no and odd no. in odd_no. If both inputs are even or both are odd store the latter in respective variable and display an error message for other. 6. Scan the age of the person in years and display whether the person is minor or adult. 7. Scan the name of the person and display the output as follows Hello Mr. _________ or Hello Mrs. _________ or Hello Ms. _________ (Assume the conditions necessary.) 8. Scan the number of hours a workers takes to finish his job if it is less than 3 hours display Highly Efficient if it is 3 to 4 hours display Efficient if it is 4 to 5 hours display Need Training if it is more than 5 hours display You are fired 9. WAP that scans cost price and selling price of a product. Find whether the seller has made profit or incurred loss; display the amount of profit or loss. 10. WAP to scan year and find whether entered year is leap year or not. 11. WAP to scan three angles of a triangle and state whether entries are legal or not. (i.e. whether the triangle is constructible or not.) 12. WAP to scan three sides of a triangle and state whether the triangle is constructible not. If constructible find whether it is equilateral, isosceles or scalene. Also check if it is Right angled triangle. 13. WAP to check whether area of triangle is greater than its perimeter. 14. WAP to check whether the character entered is a capital case, small case, a digit or a special symbol. 15. A library fines in following manner if books are returned late: 50 paise per day for less than 5 days 1 Rupee per day for 6 to 15 days 5 Rupees per day for 16 to 20 days 10 Rupees per day for 21 to 30 days Membership cancelled for more than 30 days. Scan the number of days the books is returned late. Display the appropriate fine or Membership Cancelled. 16. Scan three points in x1, y1, x2, y2, x3 and y3. State whether the three lines fall on the straight line or not. 17. Scan three points in x1, y1, x2, y2, x3 and y3. find whether a Triangle is constructible using these three points, if yes, find the area of the triangle. 18. WAP to scan three sides of a triangle and state whether the triangle is constructible not. If constructible find the area of the triangle. 19. A company insures the employees in following case : If the employee is married If the employee is unmarried and above 30 years the employee is unmarried, female and above 25 years WAP to scan data of an Employee and state whether he can be insured or not. 20. WAP to scan ages of Ram, Shyam and Ajay and state who is youngest.

21. WAP to check whether input number is in the range of 1 to 300 and is divisible by 7 or not. 22. WAP to scan two values from user, later interchange the values of the variables. 23. Interchange the values of two variables without using third variable. 24. WAP to scan a distance in Kilometers and display the same value in meter, feet, inches and centimeter. 25. WAP to accept the number of month from user and check if it is between 1 to 12, if so display the number of days in the month. 26. Nesting of if( ).. else , statements ELSE . IF 27. WAP to scan percentage of a student and display the division. 28. WAP to scan a number of 1 digit, display the digit in Words SWITCH( ) .CASE 29. WAP to scan a number of 1 digit, display the digit in Words 30. WAP to scan a character from keyboard, if character is a or A print Apple if character is b or B print Bat if character is c or C print Cat 31. WAP to accept the number of month from user and check if it is between 1 to 12, if so display the number of days in the month. 32. Write a menu driven program to accept choice from user in ch and accordingly perform basic arithmetic operations ( +, -, *, /, % ) on two float values accepted from user in x and y.

Iterative Statements or Loops while( ) . 33. WAP to print your name on screen 10 times by showing the index. 34. WAP to scan a number and print its table. (in proper format) 35. Pretest and post-test loops 36. break and continue statements 37. while( ) is entry control loop, do while( ) is exit control loop DO . WHILE( ) 18. WAP to print the digits of any sanned number. 19. Extend above program to print sum of digits of the number. 20. Write a program to accept an integer (n) from the user and find its sum of digits and it reverse. E.g. :- Input = 473 Sum of digits = 14 Reverse = 374 21. Write a program to accept an integer (n) and find its binary equivalent (b). E.g. :- if n = 13 then b = 1101. 22. WAP to scan a number and check whether it is prime or not. FOR( )

23. Write a program to accept an integer (n) from the user and find the sum (sum) and average (avg) of first n natural numbers. 24. Write a program to accept an integer form the user in n and find its factorial (fact). 25. Write a program to accept an integer (n) from the user and to display the first n Fibonacci numbers. 26. Write a program to accept an integer (n) from the user and to check whether it is Armstrong or not. 27. Write a program that will count from 1 to n and print the count, and its square, for each count. 28. Write a program that counts from 1 to n and prints the count and its inversion to 5 decimal places for each count. This will require a floating point number. 29. Write a program that will count from 1 to 100 and print only those values between 32 and 39, one to a line. Use the incrementing operator for this program. 30. Write a program to count from 7 to -5 by counting down. Use #define statements to define the limits. (Hint, you will need to use a decrementing variable in the third part of the for loop control. 31. Write a program to accept number of lines (n) from the user and display the following pattern on the screen. ( The pattern is shown for n = 4 and should vary according to the value of n )
1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 38. Write a program to accept number of lines (n) from the user and display the following

pattern on the screen. ( The pattern is shown for n = 4 and should vary according to the value of n )
* * * * * * * * * * * * * * * *

39. There can be various simplified forms of the above question.

Array
1. Define two integer arrays, each 10 elements long, called array1 and array2. Using a loop, put some kind of nonsense data in each and add them term for term into another 10 element array named arrays. Finally, print all results in a table with an index number. 2. Write a program to accept n elements from the user in array a. Display them in the reverse order of input. 3. Write a program to accept n integers from the user in array a. Find their average and display all the integers which are greater than the average.

4. Write a function search to accept an array of integers x and a search element ele. The function returns the number of occurrences of ele in the given array. Use this function in main to display the number of occurrences of the element. 5. Write a function sort which accepts an array of integers x and number of elements n. The function sorts the array in ascending order. Similarly create function sort1 which sorts the array in descending order. Use these functions in main to accept the array from the user and sort it in ascending or descending order depending on the users choice. 6. Binary Search on Array. 7. Deviation from the average. 8. Write a program to accept two matrices from user and check whether the multiplication is possible or not. If it is possible then multiply them and display the result in matrix form. 9. Write a function isnull to accept a square matrix and check whether it is null matrix or not. Similarly create functions isunit and isscalar. Use these functions in main to accept a square matrix and determine its type.

You might also like