Programming Questions

Lets Learn Programming Language

Basic

  1. WAP to accept two numbers and print the sum of two numbers?
  2. Accept five subject marks and print the average?
  3. Ram basic salary is input through keyboard. His HRA is 50% of basic salary and DA is 20 % of basic salary. Calculate the gross salary?
  4. Enter any 4 digits and check if it is palindrome?
  5. Enter any 4 digits and print the sum of 4 digits?
  6. WAP to swap two numbers.
  7. WAP to swap two numbers without using third variable.
  8. Enter any character and change the case of that character?

Simple If Construct

  1. Enter any number and display the day of week?
  2. Enter any number and display the month?
  3. Accept two numbers from a user and find the greatest of two?
  4. Accept three numbers from a user and find the greatest of three?
  5. Write a program to accept a year and find out whether the year is leap year or not?
  6. Write a program to accept a number and display a message indicating whether it is positive or negative number?
  7. Accept age from a user and check the age, if the age is greater the 50 print OLD and if it is less then and equal to 50 it should print YOUNG.
  8. Write a program to convert temperature in farnehite to Celsius?

                    Formula of Celsius = (f-32)*5/9

                                        Farnehite = 9/5*C+32

9.       Write a program to reverse a number?

                     Enter-I=12345

                      Reverse-J=54321

Nest If Construct

  1. Accept three numbers from a user and find the greatest of three?

 If Construct with Logical Operators

  1. Accept total sales and check if the sales is greater than 5000 commission is 12.5% and if sales is between 2000 and 5000 than the commission is 12% and if the sales is between 500 and 2000 than commission should be 10% otherwise no commission?
  2.  Write a program to accept the book name and selling price and find out the discount on selling price. If selling price is above 1000 discount is of 20% and if selling price is between 800-1000 discount is 15% and if selling price is less than 500 no discount is given?

Switch Case

  1. Enter any number and display the day of week?
  2. Enter any number and display the month?

Loops

  1. Print the sum of first 100 natural numbers?
  2. Print the sum of first n natural number. Where n is the number entered by the user?
  3. Write a program to accept a number and to find out whether the number is divisible by 5 or not?
  4. Display all palindrome numbers from 1 to 1000?
  5. W.A.P to display number from 1 to 50. Five integers per line?
  6.   Write a program of count down and display blast?
  7.  Write a program to accept 10 number and display total number of odd and even?
  8.   Write a program to accept 20 number and find out how many are divisible by 5, display count?
  9.  Write a program to accept name, address and marks in 4 subjects and find the average marks. Display name, address, marks. Repeat this for 5 students?
  10. Write a program to find out the highest of any ten numbers?
  11. Write a program to find factorial of number?
  12. WAP to print Fibonacci numbers less than given user number?
  13. Write a C program to create function power and calculate the power of any number.

For example:
Assume number = 5
Power = 3
Result = 5*5*5 = 125

Single Dimensional Arrays

  1. Enter any 10 numbers and display them?(using Arrays)
  2. Enter any 10 numbers and print the sum of them? (using Arrays)
  3. Enter any 10 numbers and check how many of them are even?
  4. Enter any 10 numbers and check the lowest of all?
  5. Enter any two strings and check them if they are equal of not?
  6. Write a program to find string entered by a user is a palindrome?
  7. Write a program to find length of string?
  8. Write a program to reverse a string?
  9. Write a program to find out a vowel in a string?
  10. Write a program to find character in a string?
  11. Write a program to find character in a string and replace it with another?
  12. Write a program to accept a string and find the occurrence in a string?
  13. Write a program to find words in a string?
  14. Write a program to replace a word with new word?
  15. Write a program to concatenate two string?
  16. Write a program to accept 10 number and print it in reverse order?
  17. WAP  for searching minimum and maximum number in ten numbers
  18. WAP for counting the number of characters and words in a given string

 Two Dimensional Arrays

  1. Enter any 2 matrix and add them?
  2. Enter any 2 matrix and print the product?
  3. Enter any number and print it in words?
  4. Write a program to accept the number and print in words format?

                               Enter-14

                               Words- one four

Functions 

  1. Print the sum of digits using recursion?
  2. Write a program to swap two numbers?
  3. Write a C program to generate Fibonacci series using recursion method.
  4. Solve all above question’s using functions.

Patterns using loops:

Draw the following patterns using loop:

pattarn1

pattarn2

pattarn3