Skip to content

A collection of C programs and exercises to practice loops, conditionals, arrays, and more. Perfect for beginners honing their problem-solving skills in C.

Notifications You must be signed in to change notification settings

guruprasanth02/Problem-Solving-in-C

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Problem Solving in C

A collection of C programs and solutions for various algorithmic and data structure problems.
This repository is my hobby project—created for fun, learning, and to keep my C skills sharp!


📚 About

  • Each problem is solved in C language and stored in folders by topic and sequence.
  • Problems cover a range of fundamental programming concepts for practice.
  • Most solutions are self-contained, with descriptive file and folder names.

🛠️ How to Use

Browse the problems below and click the (Code) links to see individual source files.

To compile and run any .c file:

gcc path/to/file.c -o program
./program

Or use your preferred C compiler.


📂 Project Structure

  • Source files are grouped in topic-wise folders: C01/, C02/, ..., C88/
  • The main directory and subfolders correspond to different problem sets or topics.
  • Problem numbers and descriptions below match folder and file names.

🚀 Problem List

CONDITIONAL STATEMENTS

  1. Write a C program to print the Hello World and its length. (Code)
  2. Write a C program to determine the value of sum after the assignment statement. (Code)
  3. Write a C program to check whether a given number is positive or negative. (Code)
  4. Write a C program to accept two integers and check whether they are equal or not. (Code)
  5. Write a C program to check whether a given number is even or odd. (Code)
  6. Write a C program to find whether a given year is a leap year or not. (Code)
  7. Write a C program to read the age of a candidate and determine whether he is eligible to cast his/her own vote. (Code)
  8. Write a C program to read the value of an integer m and display the value of n is 1 when m is larger than 0, 0 when m is 0 and -1 when m is less than 0. (Code)
  9. Write a C program to accept the height of a person in centimeters and categorize the person according to their height. (Code)
  10. Write a C program to find the largest of three numbers. (Code)
  11. Write a C program to accept a coordinate point in an XY coordinate system and determine in which quadrant the coordinate point lies. (Code)
  12. Write a C program to determine eligibility for admission to a professional course based on the criteria. (Code)
  13. Write a C program to read the roll no, name and marks of three subjects and calculate the total, percentage and division. (Code)
  14. Write a C program to check whether a triangle is Equilateral, Isosceles or Scalene. (Code)
  15. Write a C program to check whether a character is an alphabet, digit or special character. (Code)
  16. Write a C program to calculate profit and loss on a transaction. (Code)
  17. Write a program in C to calculate and print the electricity bill of a given customer. The customer ID, name, and unit consumed by the user should be captured from the keyboard to display the total amount to be paid to the customer. (Code)

LOOPS

  1. Write a program in C to display the first 10 natural numbers. (Code)
  2. Write a C program to compute the sum of the first 10 natural numbers. (Code)
  3. Write a program in C to display the cube of the number up to an integer. (Code)
  4. Write a program in C to display the multiplication table for a given integer. (Code)
  5. Write a C program to display the n terms of odd natural numbers and their sum. (Code)
  6. Write a program in C to display a pattern like a right angle triangle using an asterisk. (Code)
  7. Write a program in C to make such a pattern like a right angle triangle with a number which will repeat a number in a row. (Code)
  8. Write a program in C to make such a pattern like a right angle triangle with the number increased by 1. (Code)
  9. Write a C program to make such a pattern as a pyramid with an asterisk. (Code)
  10. Write a program in C to make a pyramid pattern with numbers increased by 1. (Code)
  11. Write a C program to calculate the factorial of a given number. (Code)
  12. Write a C program to display the sum of n terms of even natural numbers. (Code)
  13. Write a C program to make such a pattern like a pyramid with a number which will repeat the number in the same row. (Code)
  14. Write a C program to display the pattern as a pyramid using asterisks, with each row containing an odd number of asterisks. (Code)
  15. Write a program in C to print Floyd's Triangle. (Code)
  16. Write a C program to determine whether a given number is prime or not. (Code)
  17. Write a program in C to find the prime numbers within a range of numbers. (Code)
  18. Write a program in C to display the first n terms of the Fibonacci series. (Code)
  19. Write a C program to check the Armstrong number of n digits. (Code)
  20. Write a program in C to display a given number in reverse order. (Code)
  21. Write a C program to print a string in reverse order. (Code)
  22. Write a C program to check whether a number is a palindrome or not. (Code)
  23. Write a C program to find the HCF (Highest Common Factor) or GCD (Greatest Common Divisor) of two numbers. (Code)
  24. Write a program in C to find the LCM of any two numbers. (Code)
  25. Write a C program to display the sum of n terms of natural numbers. (Code)
  26. Write a C program to calculate the factorial of an odd number entered by the user. (Code)
  27. Write a C program to print a Hastag square pattern. (Code)
  28. Write a C program to display Pascal's triangle. (Code)
  29. Write a C program to create a concatenated series of a digit and calculate its sum. (Code)
  30. Write a C program to calculate the sum of the series 1/1 + 1/2 + 1/4 + 1/8+.... up to n terms, where n is input by the user. (Code)
  31. Write a C program to calculate the sum of the harmonic series up to a given positive integer n. (Code)
  32. Write a C program to count and print the number of digits in a given integer. (Code)
  33. Write a C program to calculate and display the cubes of three consecutive integers starting from a user-provided positive integer. (Code)
  34. Write a C program to print a right-angled triangle pattern of letters, where each row contains the same letter corresponding to the row number, starting from 'A'. (Code)
  35. Write a C program to count the Vowels in the given string. (Code)
  36. Write a C program to display a specified number of terms in a series where each term is double the starting value, as provided by the user. (Code)
  37. Write a C Program to Check if a Number is Automorphic. (Code)
  38. Write a C program to calculate the sum of the first and last digits of a given integer. (Code)
  39. Write a C program to calculate the sum of the middle digits of a given integer. (Code)
  40. Write a C program to swap the first and last element of a given integer. (Code)
  41. Write a C program that takes an integer input from the user and prints asterisks for all prime numbers up to that integer. (Code)
  42. Write a C program to convert a decimal number (from 1 to 40) into its equivalent Roman numeral representation. (Code)
  43. Write a C program to print a pyramid pattern of numbers where each row contains an increasing sequence followed by a decreasing sequence based on the specified number of rows. (code)
  44. Write a C program to calculate the product of the non-zero digits of a given integer, ensuring that the input is valid (not zero or containing zero digits). (Code)
  45. Write a C program to determine if a given year is a leap year and count the number of leap and non-leap years in the next ten years. (Code)
  46. Write a C program to calculate the sum of unique prime factors of a given positive integer. (Code)

ARRAYS

  1. Write a C program to input elements into an array and display them in a comma-separated format. (Code)
  2. Write a C program to input an array of integers and display the elements in reverse order. (Code)
  3. Write a C program to calculate the sum of the first and last elements, the second and second-last elements of an array, and then print the total sum of these two sums. (Code)
  4. Write a C program to remove all even numbers from an array and display the remaining odd numbers. (Code)
  5. Write a C program to input an array of integers and print all the negative elements in the array. (Code)
  6. Write a C program to find the maximum and minimum elements in an array entered by the user. (Code)
  7. Write a C program to find the second maximum element in an array. (Code)
  8. Write a C program to count and display the number of even and odd elements in an array. (Code)
  9. Write a C program to count and display the number of negative elements in an array. (Code)
  10. Write a C program to find the neighboring elements of a given number in an array, handling edge cases when the number is at the beginning or end of the array. (Code)
  11. Write a C program to insert an element at a specific position in an array. (Code)
  12. Write a C program to delete an element from a given position in an array and display the updated array. (Code)
  13. Write a C program to find the frequency of each element in an array, ensuring that elements are not counted multiple times. (Code)
  14. Write a C program to find and print the unique elements in an array, where each unique element appears exactly once. (Code)
  15. Write a C program to count the number of duplicate elements in an array. (Code)
  16. Write a C program to remove duplicate elements from an array entered by the user. (Code)
  17. Write a C program to separate even and odd numbers from a given array and display them in two separate arrays. (Code)
  18. Write a C program to add a given number to the number formed by the elements of an array and print the updated array. (Code)
  19. Write a C program to sort an array of integers in ascending order using the bubble sort algorithm. (Code)
  20. Write a C program to perform left rotation of an array by a given number of positions. (Code)
  21. Write a C program to perform right rotation of an array by a given number of positions. (Code)
  22. Write a C program to swap the first and last elements of an array entered by the user and display the modified array. (Code)
  23. Write a C program to modify an array such that for each element (except the first and last), if it is greater than its immediate neighbors, replace it with the sum of itself and its two neighbors. (Code)
  24. Write a C program to separate the even and odd elements of an array and display them in a new array, with all even numbers first, followed by all odd numbers. (Code)
  25. Write a C program to compare two matrices of user-defined size and check if they are equal. (Code)

🤝 Contributing

This is a personal, hobby project, but if you find a bug or have a cool C solution to share, feel free to fork and open a pull request!


📝 License

This project is open source under the MIT License.


Happy coding!

About

A collection of C programs and exercises to practice loops, conditionals, arrays, and more. Perfect for beginners honing their problem-solving skills in C.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages