C Exercises – Practice Questions with Solutions for C Programming

The best way to learn C programming language is by hands-on practice. This C Exercise page contains the top 30 C exercise questions with solutions that are designed for both beginners and advanced programmers. It covers all major concepts like arrays, pointers, for-loop, and many more.

C-Exercises

So, Keep it Up! Solve topic-wise C exercise questions to strengthen your weak topics.

C Programming Exercises

The following are the top 30 programming exercises with solutions to help you practice online and improve your coding efficiency in the C language. You can solve these questions online in GeeksforGeeks IDE.

Q1: Write a Program to Print “Hello World!” on the Console.

In this problem, you have to write a simple program that prints “Hello World!” on the console screen.

For Example,

Click here to view the solution.

Q2: write a program to find the sum of two numbers entered by the user..

In this problem, you have to write a program that adds two numbers and prints their sum on the console screen.

Q3: Write a Program to find the size of int, float, double, and char.

In this problem, you have to write a program to print the size of the variable.

Q4: Write a Program to Swap the values of two variables.

In this problem, you have to write a program that swaps the values of two variables that are entered by the user.

Swap-two-Numbers

Swap two numbers

Q5: Write a Program to calculate Compound Interest.

In this problem, you have to write a program that takes principal, time, and rate as user input and calculates the compound interest.

Q6: Write a Program to check if the given number is Even or Odd.

In this problem, you have to write a program to check whether the given number is even or odd.

Q7: Write a Program to find the largest number among three numbers.

In this problem, you have to write a program to take three numbers from the user as input and print the largest number among them.

Q8: Write a Program to make a simple calculator.

In this problem, you have to write a program to make a simple calculator that accepts two operands and an operator to perform the calculation and prints the result.

Q9: Write a Program to find the factorial of a given number.

In this problem, you have to write a program to calculate the factorial (product of all the natural numbers less than or equal to the given number n) of a number entered by the user.

Q10: Write a Program to Convert Binary to Decimal.

In this problem, you have to write a program to convert the given binary number entered by the user into an equivalent decimal number.

Q11: Write a Program to print the Fibonacci series using recursion.

In this problem, you have to write a program to print the Fibonacci series(the sequence where each number is the sum of the previous two numbers of the sequence) till the number entered by the user using recursion.

FIBONACCI-SERIES

Fibonacci Series

Q12: Write a Program to Calculate the Sum of Natural Numbers using recursion.

In this problem, you have to write a program to calculate the sum of natural numbers up to a given number n.

Q13: Write a Program to find the maximum and minimum of an Array.

In this problem, you have to write a program to find the maximum and the minimum element of the array of size N given by the user.

Q14: Write a Program to Reverse an Array.

In this problem, you have to write a program to reverse an array of size n entered by the user. Reversing an array means changing the order of elements so that the first element becomes the last element and the second element becomes the second last element and so on.

reverseArray

Reverse an array

Q15: Write a Program to rotate the array to the left.

In this problem, you have to write a program that takes an array arr[] of size N from the user and rotates the array to the left (counter-clockwise direction) by D steps, where D is a positive integer. 

Q16: Write a Program to remove duplicates from the Sorted array.

In this problem, you have to write a program that takes a sorted array arr[] of size N from the user and removes the duplicate elements from the array.

Q17: Write a Program to search elements in an array (using Binary Search).

In this problem, you have to write a program that takes an array arr[] of size N and a target value to be searched by the user. Search the target value using binary search if the target value is found print its index else print ‘element is not present in array ‘.

Q18: Write a Program to reverse a linked list.

In this problem, you have to write a program that takes a pointer to the head node of a linked list, you have to reverse the linked list and print the reversed linked list.

Q18: Write a Program to create a dynamic array in C.

In this problem, you have to write a program to create an array of size n dynamically then take n elements of an array one by one by the user. Print the array elements.

Q19: Write a Program to find the Transpose of a Matrix.

In this problem, you have to write a program to find the transpose of a matrix for a given matrix A with dimensions m x n and print the transposed matrix. The transpose of a matrix is formed by interchanging its rows with columns.

Q20: Write a Program to concatenate two strings.

In this problem, you have to write a program to read two strings str1 and str2 entered by the user and concatenate these two strings. Print the concatenated string.

Q21: Write a Program to check if the given string is a palindrome string or not.

In this problem, you have to write a program to read a string str entered by the user and check whether the string is palindrome or not. If the str is palindrome print ‘str is a palindrome’ else print ‘str is not a palindrome’. A string is said to be palindrome if the reverse of the string is the same as the string.

Q22: Write a program to print the first letter of each word.

In this problem, you have to write a simple program to read a string str entered by the user and print the first letter of each word in a string.

Q23: Write a program to reverse a string using recursion

In this problem, you have to write a program to read a string str entered by the user, and reverse that string means changing the order of characters in the string so that the last character becomes the first character of the string using recursion. 

Reverse-a-String

reverse a string

Q24: Write a program to Print Half half-pyramid pattern.

In this problem, you have to write a simple program to read the number of rows (n) entered by the user and print the half-pyramid pattern of numbers. Half pyramid pattern looks like a right-angle triangle of numbers having a hypotenuse on the right side.

Q25: Write a program to print Pascal’s triangle pattern.

In this problem, you have to write a simple program to read the number of rows (n) entered by the user and print Pascal’s triangle pattern. Pascal’s Triangle is a pattern in which the first row has a single number 1 all rows begin and end with the number 1. The numbers in between are obtained by adding the two numbers directly above them in the previous row.

pascal-triangle

Pascal’s Triangle

Q26: Write a program to sort an array using Insertion Sort.

In this problem, you have to write a program that takes an array arr[] of size N from the user and sorts the array elements in ascending or descending order using insertion sort.

Q27: Write a program to sort an array using Quick Sort.

In this problem, you have to write a program that takes an array arr[] of size N from the user and sorts the array elements in ascending order using quick sort.

Q28: Write a program to sort an array of strings.

In this problem, you have to write a program that reads an array of strings in which all characters are of the same case entered by the user and sort them alphabetically. 

Q29: Write a program to copy the contents of one file to another file.

In this problem, you have to write a program that takes user input to enter the filenames for reading and writing. Read the contents of one file and copy the content to another file. If the file specified for reading does not exist or cannot be opened, display an error message “Cannot open file: file_name” and terminate the program else print “Content copied to file_name”

Q30: Write a program to store information on students using structure.

In this problem, you have to write a program that stores information about students using structure. The program should create various structures, each representing a student’s record. Initialize the records with sample data having data members’ Names, Roll Numbers, Ages, and Total Marks. Print the information for each student.

We hope after completing these C exercises you have gained a better understanding of C concepts. Learning C language is made easier with this exercise sheet as it helps you practice all major C concepts. Solving these C exercise questions will take you a step closer to becoming a C programmer.

Frequently Asked Questions (FAQs)

Q1. what are some common mistakes to avoid while doing c programming exercises.

Some of the most common mistakes made by beginners doing C programming exercises can include missing semicolons, bad logic loops, uninitialized pointers, and forgotten memory frees etc.

Q2. What are the best practices for beginners starting with C programming exercises?

Best practices for beginners starting with C programming exercises: Start with easy codes Practice consistently Be creative Think before you code Learn from mistakes Repeat!

Q3. How do I debug common errors in C programming exercises?

You can use the following methods to debug a code in C programming exercises Read the error message carefully Read code line by line Try isolating the error code Look for Missing elements, loops, pointers, etc Check error online

Please Login to comment...

  • WhatsApp To Launch New App Lock Feature
  • Node.js 21 is here: What’s new
  • Zoom: World’s Most Innovative Companies of 2024
  • 10 Best Skillshare Alternatives in 2024
  • 30 OOPs Interview Questions and Answers (2024)

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

We will keep fighting for all libraries - stand with us!

Internet Archive Audio

c programming problem solving pdf

  • This Just In
  • Grateful Dead
  • Old Time Radio
  • 78 RPMs and Cylinder Recordings
  • Audio Books & Poetry
  • Computers, Technology and Science
  • Music, Arts & Culture
  • News & Public Affairs
  • Spirituality & Religion
  • Radio News Archive

c programming problem solving pdf

  • Flickr Commons
  • Occupy Wall Street Flickr
  • NASA Images
  • Solar System Collection
  • Ames Research Center

c programming problem solving pdf

  • All Software
  • Old School Emulation
  • MS-DOS Games
  • Historical Software
  • Classic PC Games
  • Software Library
  • Kodi Archive and Support File
  • Vintage Software
  • CD-ROM Software
  • CD-ROM Software Library
  • Software Sites
  • Tucows Software Library
  • Shareware CD-ROMs
  • Software Capsules Compilation
  • CD-ROM Images
  • ZX Spectrum
  • DOOM Level CD

c programming problem solving pdf

  • Smithsonian Libraries
  • FEDLINK (US)
  • Lincoln Collection
  • American Libraries
  • Canadian Libraries
  • Universal Library
  • Project Gutenberg
  • Children's Library
  • Biodiversity Heritage Library
  • Books by Language
  • Additional Collections

c programming problem solving pdf

  • Prelinger Archives
  • Democracy Now!
  • Occupy Wall Street
  • TV NSA Clip Library
  • Animation & Cartoons
  • Arts & Music
  • Computers & Technology
  • Cultural & Academic Films
  • Ephemeral Films
  • Sports Videos
  • Videogame Videos
  • Youth Media

Search the history of over 866 billion web pages on the Internet.

Mobile Apps

  • Wayback Machine (iOS)
  • Wayback Machine (Android)

Browser Extensions

Archive-it subscription.

  • Explore the Collections
  • Build Collections

Save Page Now

Capture a web page as it appears now for use as a trusted citation in the future.

Please enter a valid web address

  • Donate Donate icon An illustration of a heart shape

Computer science : a structured programming approach using C

Bookreader item preview, share or embed this item, flag this item for.

  • Graphic Violence
  • Explicit Sexual Content
  • Hate Speech
  • Misinformation/Disinformation
  • Marketing/Phishing/Advertising
  • Misleading/Inaccurate/Missing Metadata

[WorldCat (this item)]

plus-circle Add Review comment Reviews

462 Previews

13 Favorites

DOWNLOAD OPTIONS

No suitable files to display here.

PDF access not available for this item.

IN COLLECTIONS

Uploaded by station07.cebu on March 15, 2023

SIMILAR ITEMS (based on metadata)

Master Programming

C Programming Exercises With Solutions (PDF)

Here you will get C Programming Exercises With Solutions.

Here I am going to provide you a document of these, which you can download and make changes according to your own.

C Programming Exercises With Solutions

Download C Programming Practical Assignments Questions

Download Now

Download C Programming Exercises With Solutions PDF (2020)

Download c programming exercises with solutions pdf (2021), download 100+ c programming exercises pdf.

If you face any problem in downloading C Programming Practical Assignments Questions and Solutions PDFs, then tell us in the comment below and you will definitely share this post with your friends so that they can also be of some help.

Also Read -:

  • Database Management System Lab Assignment Exercise Question and There Solutions
  • C++ Lab Exercises And Solutions (PDF) – Master Programming
  • Web Technology Lab Assignment Question And Solutions
  • Pc Software Practical Assignment Question And Solutions
  • Operating System with Linux Lab Assignment Question And Solutions (PDF)

' src=

Jeetu Sahu is A Web Developer | Computer Engineer | Passionate about Coding and Competitive Programming

IMAGES

  1. what are the steps in problem solving in c

    c programming problem solving pdf

  2. (PDF) Problem Solving Through C Programming

    c programming problem solving pdf

  3. 6 Ways to Improve Your Programming Problem Solving

    c programming problem solving pdf

  4. Problem solving & c programming

    c programming problem solving pdf

  5. Problem Solving With C++ Pdf

    c programming problem solving pdf

  6. Programming and Problem Solving With C++

    c programming problem solving pdf

VIDEO

  1. Exercise 1: How to solve coding problems

  2. Pointers: Boht Aasan Hai! in C

  3. C Programming for Problem Solving ( VTU 1st Year ) Module 2 || (18CPS13/23)

  4. Mastering C Language: Interactive Quiz Game

  5. C programming problem 1

  6. C Programming Workshop Day 01

COMMENTS

  1. PDF Programming for problem solving using C Notes Unit

    Programming for problem solving using C Notes Unit - I Computer History, Hardware, Software, Programming Languages and Algorithms: Components andfunctions of a Computer System, Concept of Hardware and Software Programming Languages: Low- level and High-level Languages, Program Design Tools: Algorithm, Flowchart, Pseudo code.

  2. PDF Programming for Problem Solving Digital Notes B.tech (I Year I Sem

    (R18A0501) PROGRAMMING FOR PROBLEM SOLVING SYLLABUS Course Objectives • To understand the various steps in Program development. • To understand the basic concepts in C Programming Language. • To learn how to write modular and readable C Programs • To learn to write programs (using structured programming approach) in C to solve problems.

  3. PROBLEM SOLVING WITH C

    PROBLEM SOLVING WITH C. This self-readable and student-friendly text provides a strong programming foundation to solve problems with C language through its well-supported structured programming methodology, rich set of operators and data types. It is designed to help students build efficient and compact programs.

  4. Problem solving with C : Jones, Jacqueline A

    Problem solving with C by Jones, Jacqueline A. Publication date 1996 Topics C (Computer program language), Problem solving Publisher El Granada, CA : Scott/Jones Inc. Collection inlibrary; printdisabled; internetarchivebooks ... Pdf_module_version 0.0.15 Ppi 360 Rcs_key 24143 Republisher_date

  5. PDF Introduction to Problem Solving Using C

    Documentation - Techniques of Problem Solving - Problem solving aspects - Top- Down aspects - Implementation of algorithms - Program verification - Flowcharting, decision table, algorithms, Structured programming concepts, Programming methodologies viz. top-down and bottom-up programming. Basic Concepts of Computer

  6. PDF Problem Solving Techniques UNIT 2 PROBLEMS SOLVING USING C PROGRAMMING

    The C was written by Kerningham and Richie in the 1970s. C is used for developing computer applications in the area of system software, utility software such as device driver, network programming, databade systems, and many other areas of applications software.

  7. C Programming with Problem Solving

    Jacqueline A. Jones, Keith Harrow. Dreamtech Press, 2001 - 756 pages. Jones and Harrow present programming concepts in the context of solving problems. Each chapter introduces a problem first, and then covers the C language elements needed to solve it. Students can see how a program is built from its simplest beginning to its final polished ...

  8. PDF comp20005 Intro. to Numerical

    Programming, Problem Solving, and Abstraction with C ch05 Concepts 5.1 Abstraction 5.2 Compilation 5.3 Libraries 5.4 Generalizing 5.5 Recursion 5.6 Case study 5.7 Testing Summary 5.1 Abstraction I The expression associated with the return statement is evaluated in the context of the function. I That value is passed back to the point at which ...

  9. PDF Engineering Problem Solving with C

    This introductory-level C programming book is designed primarily for engineering students required to learn how to program. In Engineering Problem Solving with C, 4th Edition, best-selling author, Delores Etter, uses real-world engineering and scientific examples and problems throughout the text. Solutions to the problems are developed using ...

  10. PDF Introduction to Problem Solving Using C

    Step 3: Read variables a,b and c. Step 4: If a>b If a>c Display a is the largest number. Else Display c is the largest number. Else If b>c Display b is the largest number. Else Display c is the greatest number. Step 5: Stop Advantages of algorithm It is a step-wise representation of a solution to a given problem, which makes it easy to understand.

  11. PDF Programming and Problem Solving Through C

    Program Design Examples: Summation of a set of numbers. Exercises:- Generation of Fibonacci sequence, Generation of positive Prime numbers, Finding kth smallest element. Advanced Features: Type modifiers and storage class specifiers for data types, Bit operators, ? operator, & operator, * operator, Type casting, type conversion.

  12. NPTEL :: Computer Science and Engineering

    NOC:Problem Solving through Programming in C (Video) Syllabus; Co-ordinated by : IIT Kharagpur; Available from : 2017-12-21; Lec : 1; Modules / Lectures. Intro Video; Week 1. ... Lecture 7 : Introduction to C Programming Language : Download Verified; 8: Lecture 8 : Variables and Variable Types in C: Download Verified; 9: Lecture 9 : Introducing ...

  13. PDF Problem Solving Through Programming in C

    PROBLEM SOLVING THROUGH PROGRAMMING IN C PROF. ANUPAM BASU Department of Computer Science and Engineering IIT Kharagpur INTENDED AUDIENCE : BE/BTech in all disciplines BCA/MCA/M. Sc INDUSTRIES APPLICABLE TO : All IT Industries COURSE OUTLINE : This course is aimed at enabling the students to •Formulate simple algorithms for arithmetic and logical problems

  14. C Exercises

    The best way to learn C programming language is by hands-on practice. This C Exercise page contains the top 30 C exercise questions with solutions that are designed for both beginners and advanced programmers. It covers all major concepts like arrays, pointers, for-loop, and many more. So, Keep it Up!

  15. PDF Computer Programming Problem Solving Process

    Example problem: Step 1 - Identify the problem that must be solved. The first step is to identify the problem that needs to be solved. In this example, the largest number in the list must be found and displayed. Step 2 - Understand what the problem presents. The problem presents a list of numbers.

  16. PDF M3-r4: Programming and Problem Solving Through 'C ...

    51 M3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH 'C' LANGUAGE Model Question Paper NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered in the TEAR-OFF ANSWER SHEET only, attached to the question paper, as per the instructions contained therein.

  17. (PDF) C Programming for Problem Solving

    Abstract. This book provides recent aspects of programming fundamentals with deep details in easy-to-understand C programming language. It covers many program codes with descriptions to understand ...

  18. Problem solving and program design in C : Hanly, Jeri R : Free Download

    Problem solving and program design in C by Hanly, Jeri R. Publication date 1993 Topics C (Computer program language) Publisher Reading, Mass. : Addison-Wesley Pub. Co. ... Pdf_module_version 0.0.20 Ppi 300 Rcs_key 24143 Republisher_date 20201118120132 Republisher_operator [email protected] Republisher_time 860

  19. PDF ninth edition C++

    ditional problem solving and solutions are generally longer than Practice Programs. Programming Projects are appropriate for homework problems. Introduction to C++11 in the context of C++98. Examples of C++11 content includes new integer types, the auto type, raw string literals, strong enumera-

  20. C programming Exercises, Practice, Solution

    C is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations. C was originally developed by Dennis Ritchie between 1969 and 1973 at Bell Labs.

  21. PDF Programming in C: Basics

    Structure of a C program •• Every C program consists of one or more functions. -- One of the functions must be called main . -- The program will always begin by executing the main function. •• Each function must contain: -- A function heading , which consists of the function name ,,

  22. Computer science : a structured programming approach using C

    Pdf_module_version 0.0.22 Ppi 360 Rcs_key 24143 Republisher_date 20230322202501 Republisher_operator [email protected] Republisher_time 666 Scandate 20230315053219 Scanner station07.cebu.archive.org Scanningcenter cebu Scribe3_search_catalog isbn Scribe3_search_id 9780534491321 Tts_version 5.5-initial-237-gc5cdb0bc

  23. C Programming Exercises With Solutions (PDF)

    Here you will get C Programming Exercises With Solutions. Here I am going to provide you a document of these, which you can download and make changes according to your own. Contents hide. 1 Download C Programming Practical Assignments Questions. 2 Download C Programming Exercises With Solutions PDF (2020)