C C++ Java Data Structure Python JavaScript CSS Ajax PL/SQL PHP Puzzles C programs C++ programs Java programs

Home » C programs

C programming Basic Input, Output, if else, Ternary Operator based Programs

In this section, there are unique and logical programs available on Basic Input Output, If else, Conditional Statement (Ternary Operator) based programs. These programs are starts from very basic level to high level. Each program contains source codes, output and explanation of the logic.

List of C programming Basic Input, Output, if else, Ternary Operator based Programs.



  1. C program to print "Hello World!" / First C program.
    This is our first program in C language; this program will print “Hello World” on the screen, it is implemented using simple method as well as using c language user defined function.
  2. C program to find subtraction of two integer number.
    In this C program, we are going to read two integers numbers and find subtraction of given numbers.
  3. Program to find sum and average of two numbers.
    In this program, we will read two integer numbers and find their SUM and Average and then both results will be printed on the screen.
  4. C program to print ASCII value of a character.
    In this C program, we are going to learn how to get and print the ASCII value of a given character? This is simple C program, where we will print the ASCII code of a character.
  5. C program to find cube of an integer number using two different methods.
    In this C program, we are going to find cube of an integer number. Here, we will implement the program by using two methods 1) without using pow() function and 2) using pow() function.
  6. C program to find quotient and remainder.
    In this program, we will read divisor and dividend and then find the quotient and remainder, results will be printed on the screen.
  7. Program to calculate simple interest.
    In this program we will read principle, amount and rate and then calculate simple interest of borrowed principle based on give number of years and rate.
  8. Program to check whether number is EVEN or ODD.
    In this C program, we will read an integer number and program will check whether given integer number is EVEN or ODD.
  9. Program to find largest number among three numbers.
    In this C program, we will read three integer number from user and print the largest number among them.
  10. C program to check whether a person is eligible for voting or not?
    In this program, we are going to learn how to check that, a person is eligible for voting or not, when age is given or input through the user?
  11. C program to read marks and print percentage and division.
    In this C program, we are going to read marks in 3 subjects, we will find the total, percentage and print the division based on the percentage.
  12. Program to find gross salary of an employee.
    In this program, we will read Basic Salary of an employee and calculate HRA, DA, and Provident Fund, based on these parameters we will calculate the gross salary of the employee and print it on the screen.
  13. C program to convert temperature from Fahrenheit to Celsius and vice versa.
    This C program is to convert temperature from Fahrenheit to Celsius and vice versa, program will ask the choice for conversion from the user and find the converted temperature based on given input.
  14. C program to calculate X^N (X to the power of N) using pow function.
    This C program will read two integer number as X and Y and them calculate the X^Y (X to the power Y) and print the result on Screen.
  15. C program to find the difference of two numbers.
    This C program cannot be used to find the subtraction, in this program we are going to find the differences of two integer numbers. Here, we will check which largest number is and to get the difference, smallest number will be subtracted from largest number.
  16. C program to print size of variables using sizeof() operator.
    sizeof() is an operator in C language, which is used to print the occupied size of a variable (or size of a value), in this C program, we will print the size of different declared variables.
  17. C program to demonstrate examples of escape sequences.
    Escape sequences are the set of characters followed by the escape (\), in this program, we will learn to use of different escape sequence like new line character, backspace character etc.
  18. C program to find area and perimeter of circle.
    This c program will read radios of a circle and find their perimeter and area of a circle.
  19. C program to find area of a rectangle.
    This c program will read length and breadth of a rectangle and calculate its area; area of rectangle will be printed on the screen.
  20. C program to calculate HCF of two numbers.
    This program will read two integers and print their HCF (Highest Common Factor).
  21. C program to multiply two numbers using plus operator.
    This C program will read two integer numbers and calculate their multiplication (product) using plus operator, here we will not multiplication (*) operator.
  22. C program to demonstrate example of global and local scope.
    Basically, variables have two types of scopes, in which they can be accesses. This C program, we will demonstrate use of Global and Local scope of variables.
  23. C program to demonstrate example of floor and ceil functions.
    This C program will find the rounded float values using floor and ceil function, which are the library functions of math.h header file.
  24. C program to read Formatted Time Once through Scanf in C Language.
    In this C program we will learn how to read formatted time using scanf(), the input formatted will be “HH:MM:SS”.
  25. C program to define, modify and access a global variable.
    In this C program, we will learn how to declare, define, access and modify the value of Global variables in C programming language?
  26. C program to convert feet to inches.
    This C program will read distance in feet and convert the distance in inches. Then program will print converted feet and remaining inches on the screen.
  27. C program to print value in Decimal, Octal, Hexadecimal using printf.
    This C program will read an integer value using decimal format and print the values in Octal, Decimal and Hexadecimal format using printf.
  28. C program to print ASCII value of entered character.
    This C program will read a character from user and print its ASCII code (value) on the screen.
  29. C program to print How Many Inputs are taken from Keyboard using Scanf?
    Here, you will learn how to count total number of inputs using scanf(), suppose you read three different values using scanf(), it will return 3.
  30. C Program to calculate Employee and Employer Provident Fund.
    In this C program, we will read BASIC salary of an employee and calculate employee and employer (company) provident fund contribution.
  31. C program to set buffer with specific value using memset in C - Example of memset().
    This C program will demonstrate example of memset(), learn how to set specific value to a buffer (character arrays) using memset()?
  32. Write a C program to evaluate the net salary of an employee given the following constraints.
    Given Basic Salary, DA, HRA, TA and Other we have to calculate Net Salary of an employee where tax dedication of PF and IT using C program.
  33. How to swap two numbers without using a temporary variable using C program?
    C program to swap two integer numbers without using temporary variable: Here, we will learn how to swap numbers without taking help of another variable in C?








COMMENTS