You are on page 1of 6

4/2/23, 4:19 PM C Programs - MySirG.

Com

Home Competitive Coding Premium Join Coaching Campus Prep. Video Courses
Prog. Examples Webcast and LIVE Login

C Programs

C Programs
If you really want to learn programming then do attempt C
programs before watching its solution. Do not give up too early,
give time to yourself. When program is developed, you should
dry run it to check its correctness. Now type the code in the
editor, compile and run it. Hopefully outcome is no different
from what you were expecting, otherwise your dry run was not
done in proper manner. Finding mistakes in your program by
yourself without compiling it is very important in skill
development.
Click on the solution link for the corresponding problem.

Warm up Programs

Write a program to add two numbers.Solution


Write a program to calculate area of a circle.Solution
Write a program to print your name at the center of the
screen.
Write a program which takes input as integers only that is
restrict other characters from inputSolution

Elementary tricky programs

https://www.mysirg.com/programming-examples/c-programs/ 1/9
4/2/23, 4:19 PM C Programs - MySirG.Com

How to print %d using printf in C languageSolution


Write a program to swap two numbersSolution
Write a program to swap two numbers without using third
variableSolution
Write a program to check whether a number is even or
odd without using modulus(%) operatorSolution
Write a program to check even or odd without modulus
and bitwise operatorSolution
C Program to move your name with keystrokes

Programs on decision control(if,if else, switch)

Write a program to check whether a given number is even


or odd.Solution
Write a program to check whether a given number is
divisible by 5 or not.Solution
Write a program to to find greater between two
numbersSolution
Write a program to to find greater among three
numbersSolution
Write a program to find roots of a quadratic
equationSolution
C Program to check leap year in Hindi

Programs on Loops(while,do while, for)

Write a program to print Your name 5 times on the screen.


Solution
Write a program to print first 10 natural numbers.Solution
Write a program to print first 10 natural numbers in
reverse order.Solution
Write a program to print first N natural numbers. (N is
given by user)Solution
Write a program to print first N natural numbers in
reverse order. (N is given by user)Solution
Write a program to print first 10 even natural
numbers.Solution
Write a program to print first 10 odd natural
numbers.Solution
Write a program to print first N even natural
numbers.Solution
Write a program to print first N odd natural
numbers.Solution
Write a program to print first N even natural numbers in
reverse orderSolution
Write a program to print first N odd natural numbers in
reverse orderSolution
Write a program to print table of user’s choiceSolution
Write a program to calculate sum of first N natural
numbers Solution

https://www.mysirg.com/programming-examples/c-programs/ 2/9
4/2/23, 4:19 PM C Programs - MySirG.Com

Write a program to calculate product of first N natural


numbersSolution
Write a program to calculate factorial of a numberSolution
Write a program to calculate sum of first N even natural
numbersSolution
Write a program to calculate sum of first N odd natural
numbersSolution
Write a program to calculate x power y.(when user input x
is 2 and y is 3 then the result will be 8)Solution
Write a program to count digits in a given number.Solution
Write a program to calculate sum of the digits of a given
numberSolution
Write a program to reverse a numberSolution
Write a program to print all Armstrong numbers under
1000.Solution
Write a program to calculate LCM of two numbersSolution
Write a program to calculate HCF of two
numbers.Solution
Write a program to check whether a given number is
prime or notSolution
Write a program to print all prime numbers between two
given numbersSolution
Write a program to print all prime factors of a given
number. For example prime factors of 36 are
2,2,3,3Solution
Write a program to print first N terms of Fibonacci
seriesSolution
Write a program to check co-prime numberSolution
Write a program to print N co-prime numbersSolution
Write a program to convert a binary number to decimal
number
Write a program to convert a binary number to decimal
number improved logic
Program to print ASCII chartSolution
Program to print first n positive numbers with two bits
setSolution first logic|Solution Second Logic
Star Pattern-1 Program in CSolution
Star Pattern-2 Program in CSolution
Star Pattern-3 Program in C Solution
Star Pattern-4 Program in CSolution
Star Pattern-5 Program in CSolution
Star Pattern-6 Program in C Solution
Star Pattern-7 Program in C Solution
Star Pattern-8 Program in C Solution
Star Pattern-9 Program in CSolution
Star Pattern-10 Program in C Solution
Star Pattern-11 Program in C Solution
Star Pattern-12 Program in C Solution
Star Pattern-13 Program in CSolution
Star Pattern-14 Program in CSolution
Star Pattern-15 Program in CSolution
Star Pattern-16 Program in CSolution
https://www.mysirg.com/programming-examples/c-programs/ 3/9
4/2/23, 4:19 PM C Programs - MySirG.Com

Star Pattern-17 Program in CSolution


Star Pattern-18 Program in CSolution
Star Pattern-19 Program in CSolution
Star Pattern-20 Program in CSolution
Star Pattern-21 Program in CSolution
Star Pattern-22 Program in CSolution
Star Pattern-23 Program in CSolution
Star Pattern-24 Program in CSolution
Star Pattern-25 Program in CSolution
Star Pattern-26 Program in CSolution
Star Pattern-27 Program in CSolution
Star Pattern-28 Program in CSolution
Star Pattern-29 Program in CSolution
Star Pattern-30 Program in C Solution
Star Pattern-31 Program in C Solution
Star Pattern-32 Program in C Solution
Star Pattern-33 Program in C Solution
Star Pattern-34 Program in C Solution
Star Pattern-35 Program in CSolution
Star Pattern-35 Program in CSolution
Series Problems Program in C1+(1+2)+(1+2+3)+…+
(1+2+3+…+N)
Series Problems Print first N Prime numbers

C programs on Functions

Write a function to calculate factorial of a number.(Takes


Something, Returns Something)Solution
Write a function to calculate area of a circle.(Takes
Something, Returns Something)
Write a program to print System Date. Solution
Write a function to calculate sum of first N natural
numbers. (all four ways: TNRN, TSRN, TNRS,
TSRS)Solution
Write a function to calculate sum of squares of first N
natural numbers.(all four ways: TNRN, TSRN, TNRS,
TSRS)Solution
Write a function to print Pascal triangleSolution
Write a program to express a given number as a sum of
two prime numbers. Print all possible solutions.Solution

Programs on Recursion

Write a recursive function to calculate factorial of a


number.Solution
Write a recursive function to find Nth term of Fibonacci
series.Solution
Write a recursive function to sort an arraySolution
Write a recursive function to print first N natural
numbersSolution

https://www.mysirg.com/programming-examples/c-programs/ 4/9
4/2/23, 4:19 PM C Programs - MySirG.Com

Write a recursive function to print first N natural numbers


in reverse orderSolution
Write a recursive function to calculate sum of digits of a
number Solution
Write a recursive function to calculate sum of squares of
digits of a numberSolution
Write a recursive function to calculate sum of cubes of
first N natural numbers Solution
Write a recursive function to calculate determinant of any
orderSolution Part 1 of 3 | Solution Part 2 of 3 | Solution
part 3 of 3

Command Line Arguments

How to use command line arguments in C language using


code blocks HindiSolution
How to input integer using command line arguments in C
language Hindi Solution
C Program to add two numbers taking from command line
arguments | Hindi Solution
C Program to calculate factorial of a number taken from
command line Solution

C programs on Arrays

Write a program to calculate sum of all even numbers and


sum of all odd numbers. Numbers are entered through
keyboard and stored in an array.Solution
Write a program to find greatest among 10
numbersSolution
Write a program to find smallest among 10
numbers.Solution
Write a program to add two matrices, each of order
3×3Solution
Write a program to multiply two matrices, each of order
3×3Solution
Program to generate 10 distinct number in given range in
CSolution
Program to rotate an array by n positions in C language
Solution

C programs on Strings

Write a Program to calculate length of the string using


strlen() function.Solution
Write a program to reverse a string using strrev()
function.Solution
Write a program to reverse a string without using strrev()
function.Solution

https://www.mysirg.com/programming-examples/c-programs/ 5/9
4/2/23, 4:19 PM C Programs - MySirG.Com

Write a program to transform a string to its uppercase


Solution
Write a program to sort strings in dictionary orderSolution
Write a program to check whether a string is palindrome
or notSolution
Write a program to count words in a sentenceSolution
Write a program to reverse a string word wiseSolution
Write a program to remove adjacent duplicate characters
from a stringSolution
Write a program to check whether a given string is
alphanumeric or not.Solution
Write a program to input variable length string.
Write a program to count vowels in a given stringSolution
Write a program to find a substring in a given string
Solution

Structure in C language

Write a program that define a structure student, with


members rollno, name and age. Also define functions to
input and show student data.Solution

C programs on Linked list

How to reverse a linked list in CSolution


Program of circular linked list Part-1Solution
Program of circular linked list in C Part-2Solution
Program of Circular linked list in C Part-3Solution
Program of Circular linked list in C Part-4Solution
Program of Circular linked list in C Part-5Solution
Program of Circular linked list in C Part-6Solution
Program of Circular linked list in C Part-7Solution
Program of Circular linked list in C Part-8Solution

Graphics

Happy Valentine’s Day Program in C

https://www.mysirg.com/programming-examples/c-programs/ 6/9

You might also like