C Programming Practice Questions and Answers 


1. WAP (Write A Program) to swap two numbers using a third variable.

2. WAP to swap two numbers without using a third variable.

3. WAP to find the area of the rectangle.

4. WAP to find the area of the circle.

5. write a C prog to calculate sum of digit of given no

6. write a prog to swap two numbers using bitwise operator.

7. C Program to find ASCII value of a Character.

8. WAP to convert Temperature in Celsius to Fahrenheit  (Temperature conversion Formulae f=c*9/5+32, c=(f-32) *5/9)

9. C program to find the Size of int, float and char

10.WAP to check if a number entered is positive or negative or zero.

11.WAP to check if a number entered is even or odd

12.WAP to check if a character entered is a vowel or a consonant.

13.WAP to check if a character entered is uppercase or lowercase.

14.WAP to check if a character entered is an alphabet, number or a symbol.

15.WAP to check if a year is a leap year or not.

16.WAP to find the largest of the three numbers entered.  

          17) WAP to take input of marks of 5 subjects from the user and calculate percentage and display the grade. 

   Percentage

Grade

81% to 100%

    A

61% to 80%

    B

40% to 60%

  Pass

Less than 40 %

  Fail

     18) write a prog to accept 4 digits no from user and count zero, odd and even digits of entered no. 

     19) write a C prog to check whether given no is Armstrong or not. 

     20) accept no check it is palindrome or not 

     21) write a C prog to check whether given no is perfect or not 

    22) write prog to accept character from user and check it is alphabet, digit or punctuation symbol if it alphabets check it is lower case or upper case and then change its case

   23) C program to Display Factors of a Number

   24) WAP to take input of two numbers and a number choice from the user and display the respective arithmetic operation.    

  Number Choice

Arithmetic Operation

               1

        Addition

           2

       subtraction

           3

    Multiplication

           4

          Division

 Explanation: After the user enters 2 numbers, the user should enter a choice. If the choice entered is 1, then addition of the 2 numbers should be displayed. If the choice entered is 2, then subtraction of the 2 numbers should be displayed. And so on.

25) WAP to print numbers from 1 to 10 using

 ● Do while loop ● While loop ● For loop 

26) WAP to print numbers from 50 to 40 using 

● Do while loop ● While loop ● For loop

27) WAP to print numbers divisible by 11 between 10 and 100

 ● Do while loop ● While loop ● For loop 

28) WAP to print multiplication table of an entered number

 ● Do while loop ● While loop ● For loop 

29) WAP to print sum of numbers from 1 to 10 using

 ● Do while loop ● While loop ● For loop

30) WAP to print factorial of an entered number

 ● While loop ● For loop 

31) WAP to reverse a number using a while loop.

32) WAP to print Fibonacci series using a for loop

33) WAP to print Factorial series for first 10 naturalnumbers.

34)WAP to find if a number is prime number or not

35) write a C prog to generate following pattern for n lines

Aa 

Aa Bb

Aa Bb Cc

Aa  Bb  Cc Dd 

36) write a C prog to accept a string from user and generate following pattern (e.g. input string is "abcd") 

ab 

abc

 abcd 

abc 

ab 

a

37) display pattern for n lines

1 2 3 4

 5 6 7 

 8 9

 10

38)Display Star Pattern (Pyramid Star Pattern)

39) write prog to generate following pattern for nlines 1 3 5 7 9 11

3 5 

7 9 11 

40) write prog to display multiplication table up to given no . 

41) display each digit in words

42) Write a C prog to convert decimal no into binary, octal, hexadecimal write separate user defined function for each option 

43) write a C prog to display transpose of matrix using user defined function

 44) write C prog o accept 2 strings and compare them. if they are equal display their length. ifstr1>str2 convert str1 to uppercase and str2 to lower case and display the string and vice versa

 45) C Program to Reverse the Contents and Print it.

 46) Copy the content of one into another 

47) Accept string from user & replace all occurrences of 'a' by '*' symbol 

48) sum of elements of mxn matrix

49). write a prog to calculate factorial of given no using recursion 

50) C program to Reverse a Number 

51) Write a C program to check if a number is a palindrome. 

 52) Implement a program to convert a decimal number to binary.

 53) Create a program to find the factorial of a number using recursion. 

54) Implement a program to reverse a string without using library functions.

 55) Create a program to find the GCD (Greatest Common Divisor) of two numbers. 

56) Implement a program to find the square root of a number

57) Implement a program to check if a string is an anagram. 

58) Create a program to print the ASCII value of a character.

59) Write a program to find the largest element in an array.

 60) Implement a C program to check if a matrix is symmetric. 

61) Create a program to find the sum of elements in the main diagonal of a matrix.

 62) Write a C program to perform matrix multiplication

 63) Implement a program to calculate the power of a number using recursion.

 64) Write a program to find the second largest element in an array.