C Programming Practice Questions

  1. Write a C program to find sum and average of three numbers. 
  2. Write a C program to generate prime numbers between 1 to n
  3. Write a C program to find the largest of three numbers using an if-else statement.
  4. Write a C program to check if a given year is a leap year. A leap year is divisible by 4, but not by 100, unless it is also divisible by 400.
  5. Write a C program to reverse a given integer number. For example, if the input is 123, the output should be 321.
  6. Write a C program to find the factorial of a given number using a for loop.
  7. Write a C program to determine if a given string is a palindrome. A palindrome is a word or phrase that reads the same forwards and backwards.
  8. Write a C program to find the sum of all elements in an array of integers.
  9. Write a C program to perform matrix addition for two 2x2 matrices. The program should take the elements of both matrices as input from the user and display the resulting matrix
  10. Write a C program to implement a simple calculator that performs addition, subtraction, multiplication, and division based on the user's choice. Use a switch statement for this.
  11. Write a C program to sort an array of integers in ascending order using a simple sorting algorithm like Bubble Sort.
  12. Write a C program using a function to swap the values of two integer variables. The program should display the values before and after the swap.

Comments

Popular posts from this blog

Shell Scripting Codes - Loops

shell script collection

OS Lab Record