"Hello World!" in C Easy C (Basic) Max Score: 5 Success Rate: 85.65%

Playing with characters easy c (basic) max score: 5 success rate: 84.41%, sum and difference of two numbers easy c (basic) max score: 5 success rate: 94.61%, functions in c easy c (basic) max score: 10 success rate: 96.03%, pointers in c easy c (basic) max score: 10 success rate: 96.62%, conditional statements in c easy c (basic) max score: 10 success rate: 96.93%, for loop in c easy c (basic) max score: 10 success rate: 93.80%, sum of digits of a five digit number easy c (basic) max score: 15 success rate: 98.66%, bitwise operators easy c (basic) max score: 15 success rate: 94.99%, printing pattern using loops medium c (basic) max score: 30 success rate: 95.95%, cookie support is required to access hackerrank.

Seems like cookies are disabled on this browser, please enable them to open this website

C Functions

C structures, c reference, c exercises.

You can test your C skills with W3Schools' Exercises.

We have gathered a variety of C exercises (with answers) for each C Chapter.

Try to solve an exercise by editing some code, or show the answer to see what you've done wrong.

Count Your Score

You will get 1 point for each correct answer. Your score and total score will always be displayed.

Start C Exercises

Start C Exercises ❯

If you don't know C, we suggest that you read our C Tutorial from scratch.

Get Certified

COLOR PICKER

colorpicker

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: [email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail: [email protected]

Top Tutorials

Top references, top examples, get certified.

IncludeHelp_logo

  • Data Structure
  • Coding Problems
  • C Interview Programs
  • C++ Aptitude
  • Java Aptitude
  • C# Aptitude
  • PHP Aptitude
  • Linux Aptitude
  • DBMS Aptitude
  • Networking Aptitude
  • AI Aptitude
  • MIS Executive
  • Web Technologie MCQs
  • CS Subjects MCQs
  • Databases MCQs
  • Programming MCQs
  • Testing Software MCQs
  • Digital Mktg Subjects MCQs
  • Cloud Computing S/W MCQs
  • Engineering Subjects MCQs
  • Commerce MCQs
  • More MCQs...
  • Machine Learning/AI
  • Operating System
  • Computer Network
  • Software Engineering
  • Discrete Mathematics
  • Digital Electronics
  • Data Mining
  • Embedded Systems
  • Cryptography
  • CS Fundamental
  • More Tutorials...
  • Tech Articles
  • Code Examples
  • Programmer's Calculator
  • XML Sitemap Generator
  • Tools & Generators

IncludeHelp

Advertisement

Home » C programming language

C Programs with Solutions

This section contains popular C programs with solution. Learn and practice these programs to test and enhance your C skills. Last updated : April 01, 2023

The best way to learn C programming is by practicing and solving the C programs (C problems). We have 1000+ C programs with solutions which are categorized below. Practice these C programs to learn and enhance your C problem-solving skills.

List of C programs

Practice the C programs based on the categories, library functions, advanced, top searched, and latest.

C programs by categories

  • C Basic and Conditional Programs 90
  • C switch case programs 06
  • C 'goto' programs 10
  • Bitwise related Programs 32
  • Looping (for, while, do while) Programs 18
  • C String Manipulation programs 10
  • C String programs 50
  • String User Define Functions Programs 11
  • Recursion Programs 13
  • Number (Digits Manipulation) Programs 10
  • Number System Conversion Programs 15
  • Star/Pyramid Programs 17
  • Sum of Series Programs (set 1) 05
  • Sum of Series Programs (set 2) 13
  • Pattern printing programs 01
  • User Define Function Programs (1) 05
  • User Define Function Programs (2) 13
  • One Dimensional Array Programs 58
  • Two Dimensional Array (Matrix) Programs 21
  • File Handling Programs 32
  • Structure & Union Programs 12
  • Pointer Programs 13
  • Dynamic Memory Allocation Programs 05
  • Command Line Arguments Programs 06
  • Common C program Errors 22
  • C scanf() programs 11
  • C preprocessor programs 24
  • C typedef programs 03
  • C SQLite programs 11
  • C MySQL programs 09
  • C Tricky Programs 07
  • Misc Problems & Solutions 05

C programs on standard library functions

  • ctype.h Library Functions (Set 1)
  • ctype.h Library Functions (Set 2)
  • string.h Library Functions
  • conio.h Library Functions
  • dos.h Library Functions
  • math.h Library Functions
  • graphics.h Library Functions
  • assert.h Library Functions
  • stdio.h Library Functions

Advance C programs

  • C program to create your own header file/ Create your your own header file in C
  • gotoxy(),clrscr(),getch(),getche() for GCC, Linux.
  • fork() function explanation and examples in Linux C
  • C program to print character without using format specifiers.
  • C program to find Binary Addition and Binary Subtraction.
  • C program to print weekday of given date.
  • C program to format/extract ip address octets
  • C program to check given string is a valid IPv4 address or not.
  • C program to extract bytes from an integer (Hexadecimal) value
  • C program to store date in an integer variable

Top searched C programs

Here is the list of most important/useful programs searched on the web .

Top visited programs on IncludeHelp

  • Pattern Programs in C
  • C program to design calculator with basic operations using switch
  • C program to find factorial of a number
  • C program to check whether number is Perfect Square or not
  • C program to find SUM and AVERAGE of two numbers
  • C program to convert temperature from Fahrenheit to Celsius and Celsius to Fahrenheit
  • C program to read and print an employee's detail using structure
  • Dynamic Memory Allocation programs
  • C program to convert number from Decimal to Binary
  • C program to check whether number is Palindrome or not

Top searched programs on the web

  • First C program to print "Hello World".
  • C program to find factorial of a number.
  • C program to swap two numbers without using third variable.
  • C program to check whether a number if Armstrong or not.
  • C program to check whether a number if Even or Odd.
  • C program to print all leap years from 1 to N.
  • C program to calculate employee gross salary.
  • C Program to print tables of numbers from 1 to 20.
  • C program to print star/pyramid series.
  • C program to convert temperature from Celsius to Fahrenheit and vice versa.
  • C program to convert number from Decimal to Binary.
  • C program to convert number from Binary to Decimal.
  • C program to print ASCII Table.
  • C program to get and set current system date and time.
  • C program to run dos command.

Latest C programs

  • C program to generate random numbers within a range
  • C program to compare strings using strcmp() function
  • Interchange the two adjacent nodes in a given circular linked list | C program
  • Find the largest element in a doubly linked list | C program
  • Convert a given singly linked list to a circular list | C program
  • Implement Circular Doubly Linked List | C program
  • Print the Alternate Nodes in a Linked List without using Recursion
  • Print the Alternate Nodes in a Linked List using Recursion
  • Find the length of a linked list without using recursion
  • Find the length of a linked list using recursion
  • Count the number of occurrences of an element in a linked list without using recursion
  • Count the number of occurrences of an element in a linked list using recursion
  • C program to convert a Binary Tree into a Singly Linked List by Traversing Level by Level
  • C program to Check if nth Bit in a 32-bit Integer is set or not
  • C program to swap two Integers using Bitwise Operators
  • C program to replace bit in an integer at a specified position from another integer
  • C program to find odd or even number using bitmasking
  • C program to check whether a given number is palindrome or not using Bitwise Operator
  • C program to count number of bits set to 1 in an Integer
  • C program to check if all the bits of a given integer is one (1)
  • C program to find the Highest Bit Set for any given Integer
  • C program to Count the Number of Trailing Zeroes in an Integer
  • C Program to find the Biggest Number in an Array of Numbers using Recursion
  • C program to accept Sorted Array and do Search using Binary Search
  • C Program to Cyclically Permute the Elements of an Array
  • C program to find two smallest elements in a one dimensional array
  • Write your own memset() function in C
  • memset() function in C with Example
  • Write your own memcpy() function in C
  • memcpy() function in C with Example

Comments and Discussions!

Load comments ↻

  • Marketing MCQs
  • Blockchain MCQs
  • Artificial Intelligence MCQs
  • Data Analytics & Visualization MCQs
  • Python MCQs
  • C++ Programs
  • Python Programs
  • Java Programs
  • D.S. Programs
  • Golang Programs
  • C# Programs
  • JavaScript Examples
  • jQuery Examples
  • CSS Examples
  • C++ Tutorial
  • Python Tutorial
  • ML/AI Tutorial
  • MIS Tutorial
  • Software Engineering Tutorial
  • Scala Tutorial
  • Privacy policy
  • Certificates
  • Content Writers of the Month

Copyright © 2024 www.includehelp.com. All rights reserved.

C Solved programs, problems with solutions – C programming

C solved programs, problems with solutions.

C Solved programs —->  C is a powerful general-purpose programming language. It is fast, portable and available in all platforms. If you are new to programming, C is a good choice to start your programming journey.

This page contains the C solved programs/examples with solutions, here we are providing most important programs on each topic . These C examples cover a wide range of programming areas in Computer Science.

Every example program includes the description of the program, C code as well as output of the program. All examples are compiled and tested on a Windows system.

These examples can be as simple and basic as “Hello World” program to extremely tough and advanced C programs. Here is the List of C solved programs/examples with solutions (category wise) and detailed explanation.

C Solved Programs by categories…….

C Basic Solved Programs
C Number Solved Programs
C String Solved Programs
C Arrays Solved Programs
C Matrix Solved Programs
C Pattern Solved Programs
C Sorting Solved Programs
C Recursion Solved Programs
C Pointer Solved Programs
C File Handling Solved Programs
C Graphic Solved Programs
C Advance Solved Programs

If you found any error or any queries related to the above programs or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.

Thanks for reading the post….

No related posts.

guest

(using file handling) Enter Country Name (Inida): india 5 states() Enter Name of State : Rajasthan Enter Name of capital : jaipur show the menu of jaipur city: 1. check college in city : 2. check school Name: Enter choice : 1 show list of all college in jaipur city(10): college Name address contact no Enter choice : 2 show list of all school in jaipur city(10): school Name address contact no

Suresh Ahlay

Write a program that reads a list of integers until a stopping condition is met and then print each test score together with Pass, if the score is greater than or equal to 60, and Fail otherwise.

mahesh minho

worst website

Mahedi Hasan

Write a C program to find the sum of contiguous sub array within an array which has the smallest sum. Also print where in the array the smallest sum occurred. For example, given the array [4, -1, 2, -3, 1, -2, 7, -5, 4], the contiguous sub-array [1, -3, -2] has the smallest sum of -4 and it occurred in [0:6]. To understand contiguous sub array, given the array [1, 2, 3] the contiguous sub arrays are [1], [2], [3], [1, 2], [2, 3], [1, 2, 3], but [1, 3] is not a contiguous sub array. Sample Input Sample Output

Malu

Consider an Auto spares store which has different categories of items like. Under each category, the shop holds a maximum capacity of 1000 items. The arrangement of items in the racks vary from time to time. Based on the item type and availability, the supplier also varies. Each supplier can supply different items. The system in the shopping mall has the complete description of list of all items which includes item number, name, category, supplier name, price, total quantity and qty available. Based on the items purchased by the customer, billing is done. From the above description, initially the owner …  Read more »

pradip sapkale

#include <stdio.h>

int   main () {   int    i ;   float   avg = 0 ,  sum = 0  , a [ 10 ];  

  printf ( “Enter 10 numbers” );   for  ( i = 0 ;  i <= 9 ;  i ++)   scanf ( “ %d “ , & a [ i ]);

  for  ( i = 0 ;  i <= 9 ;  i ++); {   sum = sum + a [ i ];   avg =  sum / 10.0 ; }   printf ( “average is  %f “ ,  avg );

return   0 ; }

the output averge is 0.00000 please help i’m beginer in c programming using visual studio code

Sanskruti Jagdhane

Try with this code ..

#include<stdio.h>

int main() {  int a[20],i ,n ;  float avg=0 , sum=0 ;

 printf(“Enter no of elements in array :\n “);  scanf(“%d”, &n);  printf(“\n Enter the array of element : \n”);

 for (i=1; i<=n; i++)  {    scanf(“%d”,&a[i]);  }   for (i=1; i<=n; i++)   {     sum=sum+a[i];     avg= sum/n;   }

 printf(“\n sum of elements :%f”,sum);  printf(“\n average is %f”, avg);

return 0; }

Akash

#include <stdio.h> int main(){ /*Short and Sweet Code, Working code Please check inverted commas while running this code.*/

  int value[10];   float Sum, Average;   for(int i=0; i<=9; i++){   printf(“Enter %d number: \n”, i+1);   scanf(“%d”, &value[i]);   }

  for(int i=0; i<=9; i++){

    Sum += value[i];      } Average = Sum/10;

printf(“Average of these 10 numbers is %f”, Average);     return 0; }

#include<stdio.h> int main() { /*You have made 2 mistakes in this program.*/  int  i;  float avg=0, sum=0 ,a[10];    printf(“Enter 10 numbers”);  for (i=0; i<=9; i++)  scanf(“ %d “, &a[i]); /*ERROR 1: %d should be replaced with %f in your program because you declared a[10] as a float so you cannot use %d.*/

 for (i=0; i<=9; i++) ; /*ERROR 2: In this Loop Remove this semicolon after the brackets.*/ {  sum=sum+a[i];  avg= sum/10.0; }  printf(“average is %f“, avg);

/*After Doing this correction your program will run without giving error OR zero.*/

return 0; }

Md Forhad Ali

Plz Solve this Programe

256676832_4608769575897180_2595566630400619699_n.png

ভাই পেয়েছেন

Denn Martin Delizo

Interest is compounded annually at 10% by a certain bank. Make a program that would input an amount and a number of years (the program should test that both are positive) and output how much the original amount will be worth after that period.  

Abhishek

It’s really a wonderful website💥

ratta

The Business organization has a problem that they encounter. They received complains about the orders they have that are inaccurate mostly in selection of orders, prices, and quantity of the products. They want to have system update as soon as possible to fix this problem and asking for a refund. Every order must be confirmed to avoid any conflicts of transaction. Also the discounts are not applied when the order are wholesales which is needed to be fix when being total. Certain products are discounted either from a voucher or a wholesale that is minimum of five products. The deduction of …  Read more »

Srija

To check whether the candidate is eligible for vote or not

Krishna mistry

(A) Create a C structure, volume with fields: liter and mililiter. Read the value of two volumes and add them, if the value of mililiter is more than 1000 then add it to liter value.

John

Write a c program for There are 20 workers working in a field. the owner of Field gives them 20 rupees. In that 20 rupees each man get 4 rupees each woman get 50 paise and each child get 25 paise. Then how many are men, women, children in that 20 workers?

Revathi

A vending machine questions

LARANYA SUBUDHI

1. Write a C program to print all odd numbers between 2 values ‘n’ and ‘m’. Read the values ‘n’ and ‘m’ from the user and print all the odd numbers in this range (inclusive range, i.e if ‘n’ or ‘m’ is odd, print those as well).

Basavaraj Metri

write a programming using for loop to print all the numbers from them as even m to n there by case classifying them as even or odd

Codeforwin

Loop programming exercises and solutions in C

In programming, there exists situations when you need to repeat single or a group of statements till some condition is met. Such as – read all files of a directory, send mail to all employees one after another etc. These task in C programming is handled by looping statements .

Looping statement defines a set of repetitive statements. These statements are repeated with same or different parameters for a number of times. Looping statement is also known as iterative or repetitive statement .

C supports three looping statements.

  • do…while loop

In this exercise we will practice lots of looping problems to get a strong grip on loop. This is most recommended C programming exercise for beginners.

Always feel free to drop your queries, suggestions, hugs or bugs down below in the comments section . I always look forward to hear from you.

Required knowledge

Basic C programming , Relational operators , Logical operators , If else , For loop

List of loop programming exercises

  • Write a C program to print all natural numbers from 1 to n.  – using  while loop
  • Write a C program to print all natural numbers in reverse (from n to 1) . – using  while loop
  • Write a C program to print all alphabets from a to z.  – using  while loop
  • Write a C program to print all even numbers between 1 to 100.  – using  while loop
  • Write a C program to print all odd number between 1 to 100.
  • Write a C program to find sum of all natural numbers between 1 to n.
  • Write a C program to find sum of all even numbers between 1 to n .
  • Write a C program to find sum of all odd numbers between 1 to n .
  • Write a C program to print multiplication table of any number .
  • Write a C program to count number of digits in a number .
  • Write a C program to find first and last digit of a number .
  • Write a C program to find sum of first and last digit of a number.
  • Write a C program to swap first and last digits of a number .
  • Write a C program to calculate sum of digits of a number .
  • Write a C program to calculate product of digits of a number .
  • Write a C program to enter a number and print its reverse .
  • Write a C program to check whether a number is palindrome or not.
  • Write a C program to find frequency of each digit in a given integer .
  • Write a C program to enter a number and print it in words.
  • Write a C program to print all ASCII character with their values .
  • Write a C program to find power of a number using for loop .
  • Write a C program to find all factors of a number .
  • Write a C program to calculate factorial of a number .
  • Write a C program to find HCF (GCD) of two numbers .
  • Write a C program to find LCM of two numbers .
  • Write a C program to check whether a number is Prime number or not.
  • Write a C program to print all Prime numbers between 1 to n.
  • Write a C program to find sum of all prime numbers between 1 to n .
  • Write a C program to find all prime factors of a number .
  • Write a C program to check whether a number is Armstrong number or not.
  • Write a C program to print all Armstrong numbers between 1 to n.
  • Write a C program to check whether a number is Perfect number or not .
  • Write a C program to print all Perfect numbers between 1 to n .
  • Write a C program to check whether a number is Strong number or not .
  • Write a C program to print all Strong numbers between 1 to n .
  • Write a C program to print Fibonacci series up to n terms .
  • Write a C program to find one’s complement of a binary number .
  • Write a C program to find two’s complement of a binary number .
  • Write a C program to convert Binary to Octal number system .
  • Write a C program to convert Binary to Decimal number system .
  • Write a C program to convert Binary to Hexadecimal number system .
  • Write a C program to convert Octal to Binary number system .
  • Write a C program to convert Octal to Decimal number system .
  • Write a C program to convert Octal to Hexadecimal number system .
  • Write a C program to convert Decimal to Binary number system .
  • Write a C program to convert Decimal to Octal number system .
  • Write a C program to convert Decimal to Hexadecimal number system .
  • Write a C program to convert Hexadecimal to Binary number system .
  • Write a C program to convert Hexadecimal to Octal number system .
  • Write a C program to convert Hexadecimal to Decimal number system .
  • Write a C program to print Pascal triangle upto n rows .
  • Star pattern programs – Write a C program to print the given star patterns.
  • Number pattern programs – Write a C program to print the given number patterns .

PW Skills | Blog

C Programming Examples for Beginners With Solutions & Output

' src=

C Programming Examples include many programs, from beginner-level examples like "Hello World" and "Sum of Two Numbers" to more advanced programs like the Fibonacci series and Prime Numbers.

c problem solving questions

C Programming Examples: Are you just starting out in C programming but feeling overwhelmed? Maybe you’ve been working through the basics of C programming for a while, but are now looking to take your skills to the next level. If so, we can definitely relate!

Here, we share C programs covering various topics in C Programming, including arrays, strings, series, area & volume of geometrical figures, mathematical calculations, sorting & searching algorithms, and many more. Our goal is to provide comprehensive solutions to all C programming questions you may encounter, whether in interviews or class assignments. 

Each program in this article is accompanied by its working code and output. The programs are organized into categories, with related programs grouped together. It is recommended to grasp the fundamentals of the C language through our C tutorial before delving into these C programs. You can also download our C programming examples PDF to get instant access to C programming examples . So, whether you’re just setting out or have already made some progress in your learning adventure, this will be the perfect resource guide for honing your C coding skills!

If you find learning C language challenging, consider exploring our new C course from Physics Wallah . This interactive learning experience involves understanding a concept, completing small coding exercises, and progressing to the next lesson. Use “READER” coupon to get instant discounts on PW courses.

Also read:  C Programming Language History, Invention, Timeline & More

Table of Contents

C Programming Examples for Beginners

Below, we will share C programming examples for beginners. You can also download C language programs PDF .

1. C Hello World Program

#include <stdio.h>

int main() {

 printf(“Hello, World!\n”);

2. C Program to Print Your Own Name

 printf(“Your Name\n”);

3. C Program to Print an Integer Entered By the User

 printf(“Enter an integer: “);

 scanf(“%d”, &num);

 printf(“You entered: %d\n”, num);

4. C Program to Check Whether a Number is Prime or Not

 int num, i, flag = 0;

 printf(“Enter a number: “);

 for (i = 2; i <= num / 2; ++i) {

 if (num % i == 0) {

 if (flag == 0)

 printf(“%d is a prime number.\n”, num);

 printf(“%d is not a prime number.\n”, num);

Also read:  Top 30 Most Asked Basic Programming Questions Asked During Interviews

C Programming Examples With Solutions

Here are some C programming examples with solutions and codes:

1. C Program to Multiply two Floating-Point Numbers

 float num1, num2, product;

 printf(“Enter two floating-point numbers: “);

 scanf(“%f %f”, &num1, &num2);

 product = num1 * num2;

 printf(“Product: %f\n”, product);

2. C Program to Print the ASCII Value of a Character

 printf(“Enter a character: “);

 scanf(“%c”, &ch);

 printf(“ASCII value of %c = %d\n”, ch, ch);

3. C Program to Swap Two Numbers

 int num1, num2, temp;

 printf(“Enter two numbers: “);

 scanf(“%d %d”, &num1, &num2);

 temp = num1;

 num1 = num2;

 num2 = temp;

 printf(“After swapping: num1 = %d, num2 = %d\n”, num1, num2);

4. C Program to Calculate Fahrenheit to Celsius

 float fahrenheit, celsius;

 printf(“Enter temperature in Fahrenheit: “);

 scanf(“%f”, &fahrenheit);

 celsius = (fahrenheit – 32) * 5 / 9;

 printf(“Temperature in Celsius: %f\n”, celsius);

5. C Program to Find the Size of int, float, double, and char

 printf(“Size of int: %d bytes\n”, sizeof(int));

 printf(“Size of float: %d bytes\n”, sizeof(float));

 printf(“Size of double: %d bytes\n”, sizeof(double));

 printf(“Size of char: %d byte\n”, sizeof(char));

6. C Program to Print Prime Numbers From 1 to N

 int i, j, n;

 printf(“Enter a number (N): “);

 scanf(“%d”, &n);

 printf(“Prime numbers between 1 and %d are: “, n);

 for (i = 2; i <= n; ++i) {

 int isPrime = 1;

 for (j = 2; j <= i / 2; ++j) {

 if (i % j == 0) {

 isPrime = 0;

 if (isPrime)

 printf(“%d “, i);

Also read:  10 Best Programming Languages for Game Development in 2024

C Programming Examples With Output

Learners can also download c programming examples with output PDF to start their C language journey. But practice is the key to learning C language properly. Here are some of the best C programming examples with output :

1. C Program to Check Whether a Number is Positive, Negative, or Zero

 if (num > 0)

 printf(“Positive number\n”);

 else if (num < 0)

 printf(“Negative number\n”);

 printf(“Zero\n”);

Enter a number: 7

Positive number

2. C Program to Check Whether Number is Even or Odd

 if (num % 2 == 0)

 printf(“Even number\n”);

 printf(“Odd number\n”);

Enter a number: 15

3. C Program to Calculate Sum of Natural Numbers

 int n, sum = 0;

 printf(“Enter a positive integer: “);

 for (int i = 1; i <= n; ++i) {

 printf(“Sum of natural numbers from 1 to %d: %d\n”, n, sum);

Enter a positive integer: 5

Sum of natural numbers from 1 to 5: 15

4. C Program to Print Alphabets From A to Z Using Loop

 printf(“Alphabets from A to Z:\n”);

 for (ch = ‘A’; ch <= ‘Z’; ++ch) {

 printf(“%c “, ch);

Alphabets from A to Z:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Recommended Technical Course

  • Full Stack Development Course
  • Generative AI Course
  • DSA C++ Course
  • Data Analytics Course
  • Python DSA Course
  • DSA Java Course

C Programs for Practice

Below table shows the C programming code that you can use for practice:

1 Hello World Program Basic program to print “Hello, World!”
2 Print Your Own Name Program to print your own name
3 Add Two Numbers Program to input and add two numbers
4 Check Positive, Negative, or Zero Program to check whether a number is positive, negative, or zero
5 Even or Odd Number Program to check whether a number is even or odd
6 Vowel or Consonant Program to check whether a character is a vowel or consonant
7 Largest Number Among Three Numbers Program to find the largest number among three numbers
8 Calculate Sum of Natural Numbers Program to calculate the sum of natural numbers
9 Multiply Two Floating-Point Numbers Program to multiply two floating-point numbers
10 Print ASCII Value of a Character Program to print the ASCII value of a character
11 Swap Two Numbers Program to swap two numbers
12 Calculate Fahrenheit to Celsius Program to convert temperature from Fahrenheit to Celsius
13 Find Size of int, float, double, and char Program to find the size of int, float, double, and char
14 Add Two Complex Numbers Program to add two complex numbers
15 Print Prime Numbers From 1 to N Program to print prime numbers from 1 to N
16 Find Simple Interest Program to calculate simple interest
17 Find Compound Interest Program to calculate compound interest
18 Area and Perimeter of Rectangle Program to calculate the area and perimeter of a rectangle
19 Print Alphabets From A to Z Using Loop Program to print alphabets from A to Z using a loop
20 Armstrong Number Program to check whether a number is an Armstrong number

Why Choose C Language for Learning?

C language is an excellent entry point into the programming world due to its simplicity and ease of learning. While certain concepts may pose challenges, overall, learners find C language accessible. It introduces fundamental programming concepts like data types, variables, functions, arrays, strings, conditional statements, loops, input/output, and data structures—all foundational principles applicable to various modern programming languages.

For newcomers, acquiring proficiency in C/C++ is crucial for success in college placement interviews, especially with service-based companies such as TCS, Accenture, IBM, etc., which actively seek C developers.

Highly Efficient:

C language is renowned for its efficiency and performance. Programs written in C execute swiftly and optimize system resources effectively. 

System-level Programming:

Offering low-level control over a computer’s hardware and memory, C language is well-suited for system-level programming and the development of operating systems.

Portability:

C language is favored for its portability; its code can be compiled and executed on various platforms with minimal modifications. This makes C an ideal choice to run programs on diverse platforms.

Easy to Learn:

With a small learning curve, C language involves fewer keywords and concepts. Its syntax is easy to remember and apply. The C compiler provides descriptive errors, simplifying the debugging process and making it particularly beginner-friendly.

Versatility:

C language’s versatility allows for creating both small utility software and large-scale enterprise applications. Its broad applicability makes it a valuable language to master in programming.

Benefits of Practicing C Programming Examples

Practicing C Programming Examples offers several benefits for learners and aspiring programmers:

  • Concept Reinforcement: By working on C programming examples, individuals reinforce fundamental programming concepts such as variables, loops, conditionals, and functions. This hands-on practice helps solidify theoretical knowledge.
  • Preparation for Interviews: Many technical interviews, especially for entry-level programming positions, involve solving coding problems. Practicing C programming examples prepares individuals for such interviews, helping them perform well and showcase their coding proficiency.
  • Application of Knowledge: C programming examples provide a practical platform for applying theoretical knowledge gained from textbooks or tutorials. This application-oriented learning approach ensures a deeper understanding of programming concepts.
  • Syntax Mastery: Working on examples allows learners to master the syntax of the C programming language. Writing and debugging code regularly contributes to becoming fluent in C syntax, which is essential for effective programming.
  • Understanding Algorithms and Logic: Examples often involve implementing algorithms and logical reasoning. Working through these examples improves algorithmic thinking and logic building, essential skills for writing efficient and optimized code.
  • Skill Development: Solving a variety of programming problems enhances problem-solving skills. Each example presents a unique challenge, requiring learners to devise efficient solutions and improve their analytical and coding abilities.
  • Builds Confidence: Successfully solving programming problems instills confidence in learners. As they tackle increasingly complex examples, individuals become more comfortable handling challenging coding tasks, boosting their overall confidence in programming.
  • Diverse Problem-Solving: C programming examples cover a wide range of problems, including mathematical calculations, string manipulations, array operations, and more. This diversity exposes learners to various problem-solving approaches, enriching their programming toolkit.
  • Portfolio Building: Individuals can use the solutions to these examples to build a portfolio showcasing their coding skills. A well-documented portfolio becomes a valuable asset when seeking internships, jobs, or contributing to open-source projects.

Also read:  C++ For Kids- Learn Programming in The Fun Way

Why is it essential to practice C programming examples?

Practicing C programming examples is crucial for several reasons. It helps reinforce theoretical knowledge, enhances problem-solving skills, and provides hands-on experience with the language. Through practice, programmers become familiar with common syntax, logic building, and debugging techniques, contributing to overall proficiency in C programming.

What is the purpose of the "Swap Two Numbers" program?

The "Swap Two Numbers" program is designed to interchange the values of two variables. It is a fundamental programming exercise that helps users understand the concept of swapping values using a temporary variable or without using one. Swapping is a common operation in programming, and mastering it is essential.

Where can I find more C programming examples for practice?

You can find more C programming examples for practice on online platforms, programming websites, and educational resources.

How can I use C programming examples for learning?

Start with simple examples like Hello World and gradually progress to more complex ones. Analyze the code, understand how each line works, and experiment with modifications. This hands-on approach is effective for learning programming.

Can I modify the examples to create my programs?

Absolutely! Modifying existing examples is an excellent way to practice. Experiment with changing variables, adding features, or solving similar problems. This process fosters creativity and a deeper understanding of coding.

card-img

  • Top 20 Most Asked C++ Interview Questions

c problem solving questions

C++ Interview Questions will help you to ace your technical interview with confidence, If you are preparing for a job…

  • Addition Program In C++: Analogy-Based Examples

addition program in c++

Let us start our programming journey with a simple addition program for beginners. This article will take you through the…

  • Array Cpp: Properties, Declaration, Initialization

array cpp

Arrays are simple data structures used to store multiple values of similar types in one variable. Let us read about…

Leave a Comment Cancel Reply

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.

right adv

Related Articles

  • How To Write C Program For A Leap Year?
  • C And CPP Interview Questions And Answers
  • PW Launches C++ Game Development Mastery Course
  • How to Download Turbo C++ and Install
  • C Program For Factorial
  • Top C Plus Plus Programs List 2024
  • About C Program: Features, Data Types

bottom banner

Code With C

The Way to Programming

  • C Tutorials
  • Java Tutorials
  • Python Tutorials
  • PHP Tutorials
  • Java Projects

200+ Interview Questions for C Programming – 2024

CodeWithC

You might think of C interview questions to be way more difficult compared to your general exam question papers. Yes, C interview questions are not easy to answer, but they are not that difficult too. Your confidence to answer such interview questions correctly depends on your knowledge level related to the question, and your ability to cope up with and analyze a new problem.

In this article, we will go through some commonly asked as well as interesting questions along with their answers to help students prepare for C interviews.

Attempts have been made to cover all parts of the language in the C interview questions presented in this post. I have included relevant, interesting and common questions/problems from C basics, operators, functions, arrays, pointers, data structures, and more. To provide students a clear concept of the problems, I have included source codes, additional explanations as well as images in some questions.

The most commonly asked or frequently asked C interview questions are like What is…..What is the difference between….Write a C program to…..Find the error in the source code given below….What is the output of the source code given below….etc. I have tried to include different types of questions from different chapters/topics of the C programming language.

The C interview questions here have been divided into 3 parts – frequently asked, interesting questions and other most common C questions. I have provided complete answers along with source codes in the first two parts; I have left the third part with questions only for your own practice.

200+ Frequently Asked C Interview Questions & Answers:

C Interview Questions

Q1. Mention the different storage classes in C.

This might be one of the most debated C interview questions; the answer to this question varies book by book, and site by site on the internet. Here, I would like to make it clear there are only two storage classes in C, and the rest are storage class specifiers.

As per reference manual of “The C Programming Language” by: Brian W. Kernighan and Dennis M. Ritchie, in the Appendix A of the reference manual, the very first line says: There are two storage classes: automatic and static . [ The C programing Language 2nd Edition,Brian W. Kernighan ,Dennis M. Ritchie ]

Q2. What are the different storage class specifiers in C?

There are 4 storage class specifiers in C, out of which auto and static act as storage classes as well. So, the storage class specifiers are:

Q3. What are library functions in C?

Library functions are the predefined functions in C, stored in .lib files.

Q4. Where are the auto variables stored?

Auto variables are stored in the main memory. The default value of auto variables is garbage value.

Q5. What is the difference between i++ and ++i?

One of the most commonly asked C interview questions or viva questions – i++ and ++i. The expression i++ returns the old value and then increases i by 1, whereas the expression ++i first increases the value of i by 1 and then returns the new value.

Q6. What is l-value in C? Mention its types.

Location value, commonly known as the l-value, refers to an expression used on the left side of an assignment operator. For example: in the expression “x = 5”, x is the l-value and 5 is the r-value.

There are two types of l-value in C – modifiable l-value and non-modifiable l-value. modifiable l-value denoted a l-value which can be modified. non-modifiable l-value denote a l-value which cannot be modified. const variables are non-modifiable l-value.

Q7. Can i++ and ++i be used as l-value in C?

In C both i++ and ++i cannot be used as l-value. Whereas in C++, ++i can be used as l-value, but i++ cannot be.

Q8. Which of the following shows the correct hierarchy of arithmetic operations in C?

(1) / + * – (2) * – / + (3) + – / * (4) * / + –

4 is the correct answer.

Q9. Which bit wise operator is suitable for

  • checking whether a particular bit is on or off? Ans. The bitwise AND operator.
  • turning off a particular bit in a number? Ans. The bitwise AND operator.
  • putting on a particular bit in a number? Ans. The bitwise OR operator.

Q10. Can a C program be written without using the main function?

This is one of the most interesting C interview questions. I guess, up until now, you might not have ever written a C program without using the main function. But, a program can be executed without the main function. See the example below:

Now, lets see what’s happening within the source code. Here, #define acts as the main function to some extent. We are basically using #define as a preprocessor directive  to give an impression that the source code executes without the main function.

Q11. What is the output of printf(“%d”); ?

For printf(“%d”, a); the compiler will print the corresponding value of a. But in this case, there is nothing after %d, so the compiler will show garbage value in output screen.

Q12. What is the difference between printf() and sprintf() ?

printf() statement writes data to the standard output device, whereas sprintf() writes data to the character array.

Q13. What is the difference between %d and %*d ?

Here, %d gives the original value of the variable, whereas %*d gives the address of the variable due to the use of pointer.

Q14. Which function – gets() or fgets(), is safe to use, and why?

Neither gets() nor fgets() is completely safe to use. When compared, fgets() is safe to use than gets() because with fgest() a maximum input length can be specified.

Q15. Write a C program to print “Programming is Fun” without using semicolon (;) .

Here’s a typical source code to print “Programming is Fun”.

There’s not much trick in printing the line without using the semicolon. Simply use the printf statement inside the if condition as shown below.

An extension of the above can be – write a C program to print “;” without using a semicolon.

Q16. What is the difference between pass by value and pass by reference?

This is another very important topic in this series of C interview questions. I will try to explain this in detail with source code and output.

Pass by Value:

This is the process of calling a function in which actual value of arguments are passed to call a function. Here, the values of actual arguments are copied to formal arguments, and as a result, the values of arguments in the calling function are unchanged even though they are changed in the called function. So, passing by value to function is restricted to one way transfer of information. The following example illustrates the mechanism of passing by value to function.

In this example, the values of x and y have been passed into the function and they have been swapped in the called function without any change in the calling function.

Pass by Reference:

In pass by reference, a function is called by passing the address of arguments instead of passing the actual value. In order to pass the address of an argument, it must be defined as a pointer. The following example illustrates the use of pass by reference.

In this example, addresses of x and y have been passed into the function, and their values are swapped in the called function. As a result of this, the values are swapped in calling function also.

Q17. Write a C program to swap two variables without using a third variable.

This is one of the very common C interview questions. It can be solved in a total of five steps. For this, I have considered two variables as a and b, such that a = 5 and b = 10.

Q18. When is a switch statement better than multiple if statements?

When two or more than two conditional expressions are based on a single variable of numeric type, a switch statement is generally preferred over multiple if statements.

Q19. Write a C program to print numbers from 1 to n without using loop.

Q20. What is the difference between declaration and definition of a function?

Declaration of a function in the source code simply indicates that the function is present somewhere in the program, but memory is not allocated for it. Declaration of a function helps the program understand the following:

  • what are the arguments to that function
  • their data types
  • the order of arguments in that function
  • the return type of the function

Definition of a function, on the other hand, acts like a super set of declaration. It not only takes up the role of declaration, but also allocates memory for that function.

Q21. What are static functions? What is their use in C?

In the C programming language, all functions are global by default. Therefore, to make a function static, the “static” keyword is used before the function. Unlike the global functions, access to static functions in C is restricted to the file where they are declared.

The use of static functions in C are:

  • to make a function static
  • to restrict access to functions
  • to reuse the same function name in other file

Q22. Mention the advantages and disadvantages of arrays in C.

Advantages:

  • Each element of array can be easily accessed.
  • Array elements are stored in continuous memory location.
  • With the use of arrays, too many variables need not be declared.
  • Arrays have a wide application in data structure.

Disadvantages:

  • Arrays store only similar type of data.
  • Arrays occupy and waste memory space.
  • The size of arrays cannot be changed at the run time.

Q23. What are array pointers in C?

Array whose content is the address of another variable is known as array pointer. Here’s an example illustrating array pointers in C.

Q24. How will you differentiate  char const* p and const char* p ?

In char const* p, the pointer ‘p’ is constant, but not the character referenced by it. Here, you cannot make ‘p’ refer to any other location, but you can change the value of the char pointed by ‘p’.

In const char* p, the character pointed by ‘p’ is constant. Here, unlike the upper case, you cannot change the value of character pointed by ‘p’, but you can make ‘p’ refer to any other location.

Q25. What is the size of void pointer in C?

Whether it’s char pointer, function pointer, null pointer, double pointer, void pointer or any other, the size of any type of pointer in C is of two byte. In C, the size of any pointer type is independent of data type.

Q26. What is the difference between dangling pointer and wild pointer?

Both these pointers don’t point to a particular valid location.

A pointer is called dangling if it was pointing to a valid location earlier, but now the location is invalid. This happens when a pointer is pointing at the memory address of a variable, but afterwards some variable has been deleted from that particular memory location, while the pointer is still pointing at that memory location. Such problems are commonly called dangling pointer problem and the output is garbage value.

Wild pointer too doesn’t point to any particular memory location. A pointer is called wild if it is not initialized at all. The output in this case is any address.

Q27. What is the difference between wild pointer and null pointer?

Wild pointer is such a pointer which doesn’t point to any specific memory location as it is not initialized at all. Whereas, null pointer is the one that points the base address of segment. Literally, null pointers point at nothing.

Q28. What is far pointer in C?

C Interview Questions - Far Pointer

Q29. What is FILE?

FILE is simply a predefined data type defined in stdio.h file.

Q30. What are the differences between Structure and Unions?

  • Every member in structure has its own memory, whereas the members in a union share the same member space.
  • Initialization of all the member at the same time is possible in structures but not in unions.
  • For the same type of member, a structure requires more space than a union.
  • Different interpretations of the same memory space is possible in union but not in structures.

Q31. Write a C program to find the size of structure without using sizeof operator?

Q32. What is the difference between .com program and .exe program?

Both these programs are executable programs, and all drivers are .com programs.

  • .com program executes faster than .exe program.
  • .com file has higher preference than .exe type.

Some Interesting C Interview Questions:

Interesting C Interview Questions

The execution depends on the amount machine instruction to carry out the operation in the expression. n++ requires only a single machine instruction, such as INR, to carry out the increment operation. On the other hand, n+1 requires more machine instructions to carry out this operation. Hence, n++ executes faster than n+1 in C.

2. Is int x; a declaration or a definition? What about int x = 3; and x = 3; ?

3. What is the parent of the main() function?

The parent of main() function is header files – the <stdio.h> header file.

4. Write a C program to print the next prime number for any number entered by the user.

5. Write a C program to solve the “Tower of Hanoi” question without using recursion.

Try this yourself.

6. Create an array of char type whose size is not known until its run, i.e., the size must be given by the user.

Hints are given in the source code below. If you want to use array finish, you must free it to return resources to memory.

Other Commonly Asked C Interview Questions:

These are some other commonly asked C interview questions or exam/viva questions. Try answering these on your own, and if you need help with any, mention them in the comments section at the end.

Expression – An expression is the combination of operands and operators.

  • What is the difference between declaration and definition of a variable?
  • Can static variables be declared in a header file?
  • Can a variable be both constant and volatile?
  • What are C identifiers?
  • Can include files in C be nested?
  • What are flag values?
  • Write the prototype of printf function.
  • What is the use of void data type in C?
  • What is the use of typedef in C?
  • Differentiate for loop and while loop.
  • Why is the main() function used in C?
  • What are macros? Mention their advantages and disadvantages.
  • Mention the advantages of a macro over a function.
  • What is function recursion in C?
  • What keyword is used to rename a function in C?
  • What is the difference between Calloc() and Malloc() ?
  • What is the difference between strings and character arrays?
  • What are the differences between sizeof operator and strlen function?
  • Differentiate between static memory allocation and dynamic memory allocation.
  • What are the uses of pointers in C?
  • What is a null pointer assignment error?
  • What are enumerations?
  • Mention the advantages of using unions in C.
  • Differentiate a linker and linkage.
  • What is the difference between C++ and C programming?
  • What are the advantages of C programming?
  • What are the disadvantages of C programming?
  • Give an example of error handling in C programming.
  • How do you write a program in C?
  • What is the difference between C and C++ programming?
  • What is the use of C++?
  • Give an example of polymorphism in C++.
  • What is the difference between object-oriented and procedural programming?
  • What are the different memory models?
  • What is the difference between static and dynamic linking?
  • Explain the use of pointer.
  • What is the difference between a variable and a constant?
  • Explain the scope of variables.
  • What is a statement?
  • Explain the difference between goto and break statements?
  • What is the difference between the forward and backward jump statements?
  • How do you declare an integer variable?
  • Define what a loop is?
  • What is the difference between while and for loops?
  • What is the difference between a conditional and a loop?
  • Define what an array is?
  • Explain the use of malloc and free functions.
  • What are the types of data structures?
  • What are the different data types in C?
  • What is the difference between a data structure and a variable?
  • What is the difference between a character and a string?
  • Define the difference between a pointer and an array.
  • Define the difference between a linked list and a queue.
  • Define the difference between a stack and a heap.
  • Define the difference between a stack and a queue.
  • What is the difference between char and character?
  • What is the difference between signed and unsigned integer types?
  • What is the difference between byte and word types?
  • What is the difference between pointer and array types?
  • What is the difference between float, double, and long integer types?
  • How to declare and use variables?
  • What is the difference between integer and real types?
  • What is the difference between structure and union types?
  • What is the difference between arrays and pointers?
  • What is the difference between functions and subroutines?
  • What are the return values of functions?
  • What is the difference between switch and if statement?
  • What are the differences between for loop and while loop?
  • What is the difference between goto and break statements?
  • What is the difference between enum and typedef?
  • What are the differences between const and volatile?
  • What is the difference between inline and static?
  • What is the difference between static and volatile?
  • What is the difference between static and extern?
  • What is the difference between extern and static?
  • What is the difference between static and global?
  • What are the differences between typedef, enum, union, and struct?
  • What is the difference between char, int, float, and long?
  • What is the difference between void and int?
  • What is the difference between void and char?
  • What are the differences between union and struct types?
  • What are the differences between function and procedure types?
  • What is the difference between void and return types?
  • What is the difference between class and interface types?
  • What is the difference between pointers and arrays?
  • What is the difference between arrays and references?
  •  What is the difference between arrays and pointers?

So, what do you think of the C interview questions mentioned here? Did you find them new, difficult, interesting or boring: we would like to hear your feedback. Also, you can suggest us more interview questions that would suit this post.

You Might Also Like

Program c: building foundations with the c language, s in c programming: understanding string manipulation, program with c: starting your journey in c programming, c programming language: the foundation of system software, programs c language: creating efficient solutions.

C++ project

Nice article, I was searching for something like this i was browsing the net since ours but dint find exact question and answers which justifies the question your article is the best and have all the important questions include in it.

program to swap two variables without using a third variable doesn’t work in code blocks?

int main() { int a, b; scanf(“%d%d”,&a,&b); a=a+b; b=a-b; a=a-b; printf(“\n After swap a=%d b=%d”,a,b); return 0; }

Q: How we use graphics in C ?

Too nyc will help to upcoming students who are searching jobs

Which c programs are may ask in national c code writing competitions

Q:- Which program is used to convert object code into source code in c/c++? plz help me

I sort of get this question as — how does a source code become a program? Are you asking how does a source code get converted into object code?

If yes, the answer is compiler. Source code is turned into object code by a compiler. Then, once the object code is passed through a linker, an executable program comes into existence.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Latest Posts

62 Creating a Google Sheet to Track Google Drive Files: Step-by-Step Guide

Creating a Google Sheet to Track Google Drive Files: Step-by-Step Guide

codewithc 61 Cutting-Edge Artificial Intelligence Project Unveiled in Machine Learning World

Cutting-Edge Artificial Intelligence Project Unveiled in Machine Learning World

75 Enhancing Exams with Image Processing: E-Assessment Project

Enhancing Exams with Image Processing: E-Assessment Project

73 Cutting-Edge Blockchain Projects for Cryptocurrency Enthusiasts - Project

Cutting-Edge Blockchain Projects for Cryptocurrency Enthusiasts – Project

67 Artificial Intelligence Marvel: Cutting-Edge Machine Learning Project

Artificial Intelligence Marvel: Cutting-Edge Machine Learning Project

Privacy overview.

en_US

Sign in to your account

Username or Email Address

Remember Me

Learn C practically and Get Certified .

Popular Tutorials

Popular examples, reference materials, learn c interactively.

The best way to learn C programming is by practicing examples. The page contains examples on basic concepts of C programming. You are advised to take the references from these examples and try them on your own.

All the programs on this page are tested and should work on all platforms.

Want to learn C Programming by writing code yourself? Enroll in our Interactive C Course for FREE.

  • C Program to Create Pyramids and Patterns
  • C Program to Check Prime Number
  • C Program to Check Palindrome Number
  • C Program to Print Hello World
  • C "Hello, World!" Program
  • C Program to Print an Integer (Entered by the User)
  • C Program to Add Two Integers
  • C Program to Multiply Two Floating-Point Numbers
  • C Program to Find ASCII Value of a Character
  • C Program to Compute Quotient and Remainder
  • C Program to Find the Size of int, float, double and char
  • C Program to Demonstrate the Working of Keyword long
  • C Program to Swap Two Numbers
  • C Program to Check Whether a Number is Even or Odd
  • C Program to Check Whether a Character is a Vowel or Consonant
  • C Program to Find the Largest Number Among Three Numbers
  • C Program to Find the Roots of a Quadratic Equation
  • C Program to Check Leap Year
  • C Program to Check Whether a Number is Positive or Negative
  • C Program to Check Whether a Character is an Alphabet or not
  • C Program to Calculate the Sum of Natural Numbers
  • C Program to Find Factorial of a Number
  • C Program to Generate Multiplication Table
  • C Program to Display Fibonacci Sequence
  • C Program to Find GCD of two Numbers
  • C Program to Find LCM of two Numbers
  • C Program to Display Characters from A to Z Using Loop
  • C Program to Count Number of Digits in an Integer
  • C Program to Reverse a Number
  • C Program to Calculate the Power of a Number
  • C Program to Check Whether a Number is Palindrome or Not
  • C Program to Check Whether a Number is Prime or Not
  • C Program to Display Prime Numbers Between Two Intervals
  • C Program to Check Armstrong Number
  • C Program to Display Armstrong Number Between Two Intervals
  • C Program to Display Factors of a Number
  • C Program to Make a Simple Calculator Using switch...case
  • C Program to Display Prime Numbers Between Intervals Using Function
  • C Program to Check Prime or Armstrong Number Using User-defined Function
  • C Program to Check Whether a Number can be Expressed as Sum of Two Prime Numbers
  • C Program to Find the Sum of Natural Numbers using Recursion
  • C Program to Find Factorial of a Number Using Recursion
  • C Program to Find G.C.D Using Recursion
  • C Program to Convert Binary Number to Decimal and vice-versa
  • C Program to Convert Octal Number to Decimal and vice-versa
  • C Program to Convert Binary Number to Octal and vice-versa
  • C Program to Reverse a Sentence Using Recursion
  • C program to calculate the power using recursion
  • C Program to Calculate Average Using Arrays
  • C Program to Find Largest Element in an Array
  • C Program to Calculate Standard Deviation
  • C Program to Add Two Matrices Using Multi-dimensional Arrays
  • C Program to Multiply Two Matrices Using Multi-dimensional Arrays
  • C Program to Find Transpose of a Matrix
  • C Program to Multiply two Matrices by Passing Matrix to a Function
  • C Program to Access Array Elements Using Pointer
  • C Program Swap Numbers in Cyclic Order Using Call by Reference
  • C Program to Find Largest Number Using Dynamic Memory Allocation
  • C Program to Find the Frequency of Characters in a String
  • C Program to Count the Number of Vowels, Consonants and so on
  • C Program to Remove all Characters in a String Except Alphabets
  • C Program to Find the Length of a String
  • C Program to Concatenate Two Strings
  • C Program to Copy String Without Using strcpy()
  • C Program to Sort Elements in Lexicographical Order (Dictionary Order)
  • C Program to Store Information of a Student Using Structure
  • C Program to Add Two Distances (in inch-feet system) using Structures
  • C Program to Add Two Complex Numbers by Passing Structure to a Function
  • C Program to Calculate Difference Between Two Time Periods
  • C Program to Store Information of Students Using Structure
  • C Program to Store Data in Structures Dynamically
  • C Program to Write a Sentence to a File
  • C Program to Read the First Line From a File
  • C Program to Display its own Source Code as Output
  • C Program to Print Pyramids and Patterns
  • C Programming Home
  • ▼C Programming Exercises
  • Basic Declarations and Expressions
  • Basic Part-II
  • Basic Algorithm
  • Variable Type
  • Input - Output
  • Conditional Statements
  • Do-While Loop
  • Linked List
  • Callback function
  • Variadic function
  • Inline Function
  • File Handling
  • Searching and Sorting

C Programming Exercises, Practice, Solution : For Loop

C for loop [61 exercises with solution].

[ An editor is available at the bottom of the page to write and execute the scripts.   Go to the editor ]

1. Write a program in C to display the first 10 natural numbers. Expected Output : 1 2 3 4 5 6 7 8 9 10 Click me to see the solution

2. Write a C program to compute the sum of the first 10 natural numbers. Expected Output : The first 10 natural number is : 1 2 3 4 5 6 7 8 9 10 The Sum is : 55 Click me to see the solution

3. Write a program in C to display n terms of natural numbers and their sum. Test Data : 7 Expected Output : The first 7 natural number is : 1 2 3 4 5 6 7 The Sum of Natural Number upto 7 terms : 28 Click me to see the solution

4. Write a program in C to read 10 numbers from the keyboard and find their sum and average. Test Data : Input the 10 numbers : Number-1 :2 ... Number-10 :2 Expected Output : The sum of 10 no is : 55 The Average is : 5.500000 Click me to see the solution

5. Write a program in C to display the cube of the number up to an integer. Test Data : Input number of terms : 5 Expected Output : Number is : 1 and cube of the 1 is :1 Number is : 2 and cube of the 2 is :8 Number is : 3 and cube of the 3 is :27 Number is : 4 and cube of the 4 is :64 Number is : 5 and cube of the 5 is :125 Click me to see the solution

6. Write a program in C to display the multiplication table for a given integer. Test Data : Input the number (Table to be calculated) : 15 Expected Output : 15 X 1 = 15 ... ... 15 X 10 = 150 Click me to see the solution

7. Write a program in C to display the multiplier table vertically from 1 to n. Test Data : Input upto the table number starting from 1 : 8 Expected Output : Multiplication table from 1 to 8 1x1 = 1, 2x1 = 2, 3x1 = 3, 4x1 = 4, 5x1 = 5, 6x1 = 6, 7x1 = 7, 8x1 = 8 ... 1x10 = 10, 2x10 = 20, 3x10 = 30, 4x10 = 40, 5x10 = 50, 6x10 = 60, 7x10 = 70, 8x10 = 80 Click me to see the solution

8. Write a C program to display the n terms of odd natural numbers and their sum. Test Data Input number of terms : 10 Expected Output : The odd numbers are :1 3 5 7 9 11 13 15 17 19 The Sum of odd Natural Number upto 10 terms : 100 Click me to see the solution

9. Write a program in C to display a pattern like a right angle triangle using an asterisk.

The pattern like :

Click me to see the solution

10. Write a C program to display a pattern like a right angle triangle with a number.

11. 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.

12. Write a program in C to make such a pattern like a right angle triangle with the number increased by 1.

13. Write a program in C to make a pyramid pattern with numbers increased by 1. 1 2 3 4 5 6 7 8 9 10 Click me to see the solution

14. Write a C program to make such a pattern as a pyramid with an asterisk.

15. Write a C program to calculate the factorial of a given number. Test Data : Input the number : 5 Expected Output : The Factorial of 5 is: 120 Click me to see the solution

16. Write a C program to display the sum of n terms of even natural numbers. Test Data : Input number of terms : 5 Expected Output : The even numbers are :2 4 6 8 10 The Sum of even Natural Number upto 5 terms : 30 Click me to see the solution

17. Write a C program to make such a pattern like a pyramid with a number which will repeat the number in the same row.

18. Write a program in C to find the sum of the series [ 1-X^2/2!+X^4/4!- .........]. Test Data : Input the Value of x :2 Input the number of terms : 5 Expected Output : the sum = -0.415873 Number of terms = 5 value of x = 2.000000 Click me to see the solution

19. Write a program in C to display the n terms of a harmonic series and their sum. 1 + 1/2 + 1/3 + 1/4 + 1/5 ... 1/n terms Test Data : Input the number of terms : 5 Expected Output : 1/1 + 1/2 + 1/3 + 1/4 + 1/5 + Sum of Series upto 5 terms : 2.283334 Click me to see the solution

20. Write a C program to display the pattern as a pyramid using asterisks, with each row containing an odd number of asterisks.

21. Write a program in C to display the sum of the series [ 9 + 99 + 999 + 9999 ...]. Test Data : Input the number or terms :5 Expected Output : 9 99 999 9999 99999 The sum of the saries = 111105 Click me to see the solution

22. Write a program in C to print Floyd's Triangle.

23. Write a program in C to find the sum of the series [x - x^3 + x^5 + ......]. Test Data : Input the value of x :3 Input number of terms : 5 Expected Output : The sum is : 16.375000 Click me to see the solution

24. Write a program in C to find the sum of the series [ x - x^3 + x^5 + ......]. Test Data : Input the value of x :2 Input number of terms : 5 Expected Output : The values of the series: 2 -8 32 -128 512 The sum = 410 Click me to see the solution

25. Write a C program that displays the n terms of square natural numbers and their sum. 1 4 9 16 ... n Terms Test Data : Input the number of terms : 5 Expected Output : The square natural upto 5 terms are :1 4 9 16 25 The Sum of Square Natural Number upto 5 terms = 55 Click me to see the solution

26. Write a program in C to find the sum of the series 1 +11 + 111 + 1111 + .. n terms. Test Data : Input the number of terms : 5 Expected Output : 1 + 11 + 111 + 1111 + 11111 The Sum is : 12345 Click me to see the solution

27. Write a C program to check whether a given number is a 'Perfect' number or not. Test Data : Input the number : 56 Expected Output : The positive divisor : 1 2 4 7 8 14 28 The sum of the divisor is : 64 So, the number is not perfect. Click me to see the solution

28. Write a C program to find the 'Perfect' numbers within a given number of ranges. Test Data : Input the starting range or number : 1 Input the ending range of number : 50 Expected Output : The Perfect numbers within the given range : 6 28 Click me to see the solution

29. Write a C program to check whether a given number is an Armstrong number or not. Test Data : Input a number: 153 Expected Output : 153 is an Armstrong number. Click me to see the solution

30. Write a C program to find the Armstrong number for a given range of number. Test Data : Input starting number of range: 1 Input ending number of range : 1000 Expected Output : Armstrong numbers in given range are: 1 153 370 371 407 Click me to see the solution

31. Write a program in C to display a pattern like a diamond.

32. Write a C program to determine whether a given number is prime or not.  Test Data : Input a number: 13 Expected Output : 13 is a prime number. Click me to see the solution

33. Write a C program to display Pascal's triangle.  Test Data : Input number of rows: 5 Expected Output :

34. Write a program in C to find the prime numbers within a range of numbers. Test Data : Input starting number of range: 1 Input ending number of range : 50 Expected Output : The prime number between 1 and 50 are : 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 Click me to see the solution

35. Write a program in C to display the first n terms of the Fibonacci series. Fibonacci series 0 1 2 3 5 8 13 ..... Test Data : Input number of terms to display : 10 Expected Output : Here is the Fibonacci series upto to 10 terms : 0 1 1 2 3 5 8 13 21 34 Click me to see the solution

36. Write a C program to display a such a pattern for n rows using a number that starts with 1 and each row will have a 1 as the first and last number.

37. Write a program in C to display a given number in reverse order. Test Data : Input a number: 12345 Expected Output : The number in reverse order is : 54321 Click me to see the solution

38. Write a C program to check whether a number is a palindrome or not. Test Data : Input a number: 121 Expected Output : 121 is a palindrome number. Click me to see the solution

39. Write a program in C to find the number and sum of all integers between 100 and 200 which are divisible by 9. Expected Output : Numbers between 100 and 200, divisible by 9 : 108 117 126 135 144 153 162 171 180 189 198 The sum : 1683 Click me to see the solution

40. Write a C program to display the pyramid pattern using the alphabet.

41. Write a program in C to convert a decimal number into binary without using an array. Test Data : Input a decimal number: 25 Binary number equivalent to said decimal number is: 0000000000000000000000000001 1001 Click me to see the solution

42. Write a C program to convert a binary number into a decimal number without using array, function and while loop. Test Data : Input a binary number :1010101 Expected Output : The Binary Number : 1010101 The equivalent Decimal Number : 85 Click me to see the solution

43. Write a C program to find the HCF (Highest Common Factor) of two numbers. Test Data : Input 1st number for HCF: 24 Input 2nd number for HCF: 28 Expected Output : HCF of 24 and 28 is : 4 Click me to see the solution

44. Write a C program to find the LCM of any two numbers using HCF. Test Data : Input 1st number for LCM: 15 Input 2nd number for LCM: 20 Expected Output : The LCM of 15 and 20 is : 60 Click me to see the solution

45. Write a program in C to find the LCM of any two numbers. Test Data : Input 1st number for LCM: 15 Input 2nd number for LCM: 20 Expected Output : The LCM of 15 and 20 is : 60 Click me to see the solution

46. Write a C program to convert a binary number into a decimal number using the math function. Test Data : Input the binary number :1010100 Expected Output : The Binary Number : 1010100 The equivalent Decimal Number is : 84 Click me to see the solution

47. Write a C program to check whether a number is a Strong Number or not. Test Data : Input a number to check whether it is Strong number: 15 Expected Output : 15 is not a Strong number. Click me to see the solution

48. Write a C program to find Strong Numbers within a range of numbers. Test Data : Input starting range of number : 1 Input ending range of number: 200 Expected Output : The Strong numbers are : 1 2 145 Click me to see the solution

49. Write a C program to find the sum of an A.P. series. Test Data : Input the starting number of the A.P. series: 1 Input the number of items for the A.P. series: 10 Input the common difference of A.P. series: 4 Expected Output : The Sum of the A.P. series are : 1 + 5 + 9 + 13 + 17 + 21 + 25 + 29 + 33 + 37 = 190 Click me to see the solution

50. Write a program in C to convert a decimal number into octal without using an array. Test Data : Enter a number to convert : 79 Expected Output : The Octal of 79 is 117. Click me to see the solution

51. Write a C program to convert an octal number to a decimal without using an array. Test Data : Input an octal number (using digit 0 - 7) :745 Expected Output : The Octal Number : 745 The equivalent Decimal Number : 485 Click me to see the solution

52. Write a C program to find the sum of the G.P. series. Test Data : Input the first number of the G.P. series: 3 Input the number or terms in the G.P. series: 5 Input the common ratio of G.P. series: 2 Expected Output : The numbers for the G.P. series: 3.000000 6.000000 12.000000 24.000000 48.000000 The Sum of the G.P. series : 93.000000 Click me to see the solution

53. Write a C program to convert a binary number to octal. Test Data : Input a binary number :1001 Expected Output : The Binary Number : 1001 The equivalent Octal Number : 11 Click me to see the solution

54. Write a program in C to convert an octal number into binary. Test Data : Input an octal number (using digit 0 - 7) :57 Expected Output : The Octal Number : 57 The equivalent Binary Number : 101111

55. Write a C program to convert a decimal number to hexadecimal. Test Data : Input any Decimal number: 79 Expected Output : The equivalent Hexadecimal Number : 4F Click me to see the solution

56. Write a program in C to check whether a number can be expressed as the sum of two prime. Test Data : Input a positive integer: 16 Expected Output : 16 = 3 + 13 16 = 5 + 11 Click me to see the solution

57. Write a C program to print a string in reverse order. Test Data : Input a string to reverse : Welcome Expected Output : Reversed string is: emocleW Click me to see the solution

58. Write a C program to find the length of a string without using the library function. Test Data : Input a string : welcome Expected Output : The string contains 7 number of characters. So, the length of the string welcome is : 7 Click me to see the solution

59. Write a C program to check the Armstrong number of n digits. Test Data : Input an integer : 1634 Expected Output : 1634 is an Armstrong number Click me to see the solution

60. Write a C program that takes user input and counts the number of characters until the end of the file. Test Data : Input characters : w3resource Expected Output : Input characters: On Linux systems and OS X EOF is CTRL+D. For Windows EOF is CTRL+Z. Number of Characters: 10 Click me to see the solution

61. Write a C program that takes input from the user and counts the number of uppercase and lowercase letters, as well as the number of other characters. Test Data : Input characters : w3resource Expected Output : Input characters: On Linux systems and OS X EOF is CTRL+D. For Windows EOF is CTRL+Z. Uppercase letters: 0 Lowercase letters: 9 Other characters: 1 Click me to see the solution

C Programming Code Editor:

More to Come !

Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.

Follow us on Facebook and Twitter for latest update.

  • Weekly Trends and Language Statistics
  • C Data Types
  • C Operators
  • C Input and Output
  • C Control Flow
  • C Functions
  • C Preprocessors
  • C File Handling
  • C Cheatsheet
  • C Interview Questions

Top 50 C Coding Interview Questions and Answers (2024)

C is the most popular programming language developed by Dennis Ritchie at the Bell Laboratories in 1972 to develop the UNIX operating systems. It is a general-purpose and procedural programming language. It is faster than the languages like Java and Python. C is the most used language in top companies such as LinkedIn, Microsoft, Opera, Meta, and NASA because of its performance. To get into these companies and other software companies, you need to master some important C coding questions to crack their C Online Assessment round and coding interview.

C-coding-Questions---Answers

C Coding Interview Questions and Answers

This article on C Coding Interview Questions offers a comprehensive collection of practice questions suitable for both beginners and advanced learners.

List of 50 C Coding Interview Questions and Answer

Here is a list of 50 C coding interview questions and answers:

1. Find the largest number among the three numbers.

2. write a program to check whether a number is prime or not., 3. write a c program to calculate compound interest., 4. write a program in c to swap the values of two variables without using any extra variable., 5. write a program to replace all 0’s with 1’s in a number., 6. write a program to convert the binary number into a decimal number., 7.  write a program to check if the year is a leap year or not., 8. write a program to factorial of a number., 9. write a program to check if a number is an armstrong number or not., 10. write a program to find all the roots of a quadratic equation in c., 11. write a program to reverse a number., 12. check whether a number is a palindrome., 13. write a c program to check if two numbers are equal without using the bitwise operator. , 14. write a  c program to find the gcd of two numbers., 15. write a  c program to find the lcm of two numbers., 16. write a c program to find the maximum and minimum of two numbers without using any loop or condition. , 17. write a program in c to print all natural numbers up to n without using a semi-colon., 18. write a program to find the area of a circle., 19.  write a program to create a pyramid pattern using c., 20. write a program to form pascal triangle using numbers., 21. write a program to return the nth row of pascal’s triangle., 22. write a program to reverse an array., 23. write a program to check the repeating elements in c., 24. write a program to print the maximum and minimum elements in an array., 25. write a program for the cyclic rotation of an array to k positions., 26. write a program to sort first half in ascending order and the second in descending order., 27. write a program to print sums of all subsets in an array., 28. write a program to find if there is any subarray with a sum equal to 0., 29. write a c program to implement kadane’s algorithm, 30. write a program to find the transpose of a matrix., 31. write a program to rotate a matrix by 90 degrees in the clockwise direction in c., 32. write a program to find the spiral traversal of a matrix in c., 33. write a program to count the sum of numbers in a string., 34. program to calculate the length of the string., 35. write a program to check string is a palindrome., 36. write a program to print all permutations of a given string in lexicographically sorted order in c., 37. write a program to calculate the power of a number using recursion in c., 38. write a code to print the fibonacci series using recursion., 39. write a program to find the hcf of two numbers using recursion., 40. write a program in c to reverse a string using recursion., 41.  write a c program to search elements in an array., 42.  write a c program to search elements in an array using binary search., 43. write a c program to sort arrays using bubble, selection, and insertion sort., 44. write a c program to sort arrays using merge sort., 45. write a c program to sort arrays using quick sort., 46. write a program to sort an array using pointers., 47. write a c program to store information about students using structure, 48.  write a c program to add two complex numbers using structures and functions., 49. write a c program to add two distance given as input in feet and inches, 50. write a c program to reverse a linked list iteratively.

In this C coding interview questions and answers, we’ve compiled a wide-range of practice questions suitable for individuals at all levels, from beginners to advanced learners. Exploring these questions and their solutions will not only enhance your proficiency in C but also prepare you for a successful coding interview experience.

C Coding Interview Questions – FAQs

Q: what are the most common c coding interview questions.

The most common C coding interview questions are designed to test your knowledge of the following topics: C syntax and semantics Data structures and algorithms Memory management Pointers File I/O Some specific examples of common C coding interview questions include: Reverse a linked list. Implement a binary search tree. Write a function to find the maximum element in an array. Explain the difference between a pointer and an array. What is the difference between a function declaration and a function definition? How do you allocate memory on the heap? How do you free memory that has been allocated on the heap? What is a dangling pointer? How do you read and write data to a file?

Q. Who can benefit from these C coding interview questions and answers?

These questions are designed to benefit anyone preparing for a C coding interview. Whether you’re a beginner looking to learn the fundamentals or an experienced programmer aiming to enhance your C skills, this resource can assist you in your preparation.

Q: How can I use these questions effectively in my interview preparation?

Start by assessing your current level of expertise in C programming language. Then, you can use these questions to gradually build your skills up and knowledge. Practice solving them on your own, and review the explanations to ensure a thorough understanding.

Please Login to comment...

Similar reads.

  • Interview Questions
  • interview-questions
  • How to Get a Free SSL Certificate
  • Best SSL Certificates Provider in India
  • Elon Musk's xAI releases Grok-2 AI assistant
  • What is OpenAI SearchGPT? How it works and How to Get it?
  • Content Improvement League 2024: From Good To A Great Article

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

IMAGES

  1. Solved solve c programming

    c problem solving questions

  2. C Programming and Problem Solving Part 4

    c problem solving questions

  3. NPTEL Problem Solving Through Programming In C Assignment 1 Answers

    c problem solving questions

  4. Problem Solving Using C Part 6 C Comment statements in C

    c problem solving questions

  5. NPTEL » Problem solving Programming In C Assignment 2021

    c problem solving questions

  6. Programming and Problem Solving Through 'C' Language

    c problem solving questions

COMMENTS

  1. C Exercises

    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! Solve topic-wise C exercise questions to strengthen your weak topics.

  2. 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.

  3. Solve C

    Join over 23 million developers in solving code challenges on HackerRank, one of the best ways to prepare for programming interviews. ... For Loop in C. Easy C (Basic) Max Score: 10 Success Rate: 93.80%. Solve Challenge. Sum of Digits of a Five Digit Number. Easy C (Basic) Max Score: 15 Success Rate: 98.66%.

  4. C programming examples, exercises and solutions for beginners

    Matrix (2D array) Add two matrices. Scalar matrix multiplication. Multiply two matrices. Check if two matrices are equal. Sum of diagonal elements of matrix. Interchange diagonal of matrix. Find upper triangular matrix. Find sum of lower triangular matrix.

  5. C Programming

    1. Write a C program to get the indices of two numbers in a given array of integers. This will enable you to get the sum of two numbers equal to a specific target. Expected Output: Original Array: 4 2 1 5 Target Value: 7 Indices of the two numbers whose sum equal to target value: 7 1 3. Click me to see the solution. 2.

  6. Practice C

    Improve your C programming skills with over 200 coding practice problems. Solve these beginner friendly problems online to get better at C language.

  7. C Exercises

    We have gathered a variety of C exercises (with answers) for each C Chapter. Try to solve an exercise by editing some code, or show the answer to see what you've done wrong. Count Your Score. You will get 1 point for each correct answer. Your score and total score will always be displayed.

  8. 1000+ C Programs (C Programming Examples)

    The best way to learn C programming is by practicing and solving the C programs (C problems). We have 1000+ C programs with solutions which are categorized below. Practice these C programs to learn and enhance your C problem-solving skills. List of C programs

  9. Basic programming exercises and solutions in C

    List of basic programming exercises. Write a C program to perform input/output of all basic data types. Write a C program to enter two numbers and find their sum. Write a C program to enter two numbers and perform all arithmetic operations. Write a C program to enter length and breadth of a rectangle and find its perimeter.

  10. Top 50 C Programming Interview Questions and Answers

    C Programming Interview Questions. C Programming language is one of the languages that are both complex yet important to learn for strengthening your programming skills. Interview questions can be categorized into two parts: ... A recursive function solves a particular problem by calling a copy of itself and solving smaller subproblems that sum ...

  11. Learn Problem solving in C

    Learn problem solving in C from our online course and tutorial. You will learn basic math, conditionals and step by step logic building to solve problems easily. 4.5 (1438 reviews) 18 lessons Beginner level. 23.5k Learners.

  12. C programming exercises: Function

    C Function [12 exercises with solution] [An editor is available at the bottom of the page to write and execute the scripts. Go to the editor] 1. Write a program in C to show the simple structure of a function. Expected Output: The total is : 11 . Click me to see the solution. 2. Write a program in C to find the square of any number using the ...

  13. C Programs

    C Programs: Practicing and solving problems is the best way to learn anything. Here, we have provided 100+ C programming examples in different categories like basic C Programs, Fibonacci series in C, String, Array, Base Conversion, Pattern Printing, Pointers, etc. These C programs are the most asked interview questions from basic to advanced level.

  14. C Solved programs, problems with solutions

    C Basic Solved Programs. C Program to Print Hello World Program. C Program to calculate a simple interest. C program to convert Total days to year, month and days. C program to find Sum and Average of two numbers. C Program to check whether number is EVEN or ODD. C Program to find largest number among three numbers.

  15. Loop programming exercises and solutions in C

    List of loop programming exercises. Write a C program to print all natural numbers from 1 to n. - using while loop. Write a C program to print all natural numbers in reverse (from n to 1). - using while loop. Write a C program to print all alphabets from a to z. - using while loop.

  16. C Programming Examples For Beginners With Solutions & Output

    Diverse Problem-Solving: C programming examples cover a wide range of problems, including mathematical calculations, string manipulations, array operations, and more. This diversity exposes learners to various problem-solving approaches, enriching their programming toolkit. ... C++ Interview Questions will help you to ace your technical ...

  17. Problems

    Boost your coding interview skills and confidence by practicing real interview questions with LeetCode. Our platform offers a range of essential problems for practice, as well as the latest questions being asked by top-tier companies.

  18. C programming exercises: Array

    Write a program in C to find the minimum distance between two numbers in a given array. Expected Output: The given array is: 7 9 5 11 7 4 12 6 2 11 The minimum distance between 7 and 11 is: 1 Click me to see the solution. 85. Write a program in C to count all possible paths from top left to bottom right of a m X n matrix. Expected Output:

  19. 200+ Interview Questions for C Programming

    Q17. Write a C program to swap two variables without using a third variable. This is one of the very common C interview questions. It can be solved in a total of five steps. For this, I have considered two variables as a and b, such that a = 5 and b = 10. #include<stdio.h>. int main(){. int a=5,b=10; a=b+a;

  20. Quiz about 50 C Language MCQs with Answers

    50 C Language MCQs with Answers Quiz will help you to test and validate your C Quiz knowledge. It covers a variety of questions, from basic to advanced. The quiz contains 50 questions. You just have to assess all the given options and click on the correct answer.

  21. C Examples

    Program. C Program to Print an Integer (Entered by the User) C Program to Add Two Integers. C Program to Multiply Two Floating-Point Numbers. C Program to Find ASCII Value of a Character. C Program to Compute Quotient and Remainder. C Program to Find the Size of int, float, double and char. C Program to Demonstrate the Working of Keyword long.

  22. C programming exercises: For Loop

    Write a C program to make such a pattern as a pyramid with an asterisk. * * * * * * * * * * Click me to see the solution. 15. Write a C program to calculate the factorial of a given number. Test Data : Input the number : 5 Expected Output: The Factorial of 5 is: 120 Click me to see the solution. 16. Write a C program to display the sum of n ...

  23. Top 50 C Coding Interview Questions and Answers (2024)

    C is the most popular programming language developed by Dennis Ritchie at the Bell Laboratories in 1972 to develop the UNIX operating systems. It is a general-purpose and procedural programming language. It is faster than the languages like Java and Python. C is the most used language in top companies such as LinkedIn, Microsoft, Opera, Meta, and NASA because of its performance.