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?
  34. C program to read name and marital status of a girl and print her name with Miss or Mrs
    In this C program, we will read name and marital status of a girl and print her name Miss or Mrs based on given marital status.
  35. C program to check given number is divisible by A and B
    In this C program, we will read an integer number and check whether given integer number is divisible by A and B. Here, A and B are the divisors given by the user.
  36. C program to find sum of all numbers from 0 to N without using loop
    Here, we are implementing a C program that will be used to find the sum of all numbers from 0 to N without using loop.
  37. Input hexadecimal value in C language
    Here, we are going to learn how to input a value in hexadecimal format? To input value in hexadecimal format using scanf() – we use "%x" or "%X" format specifier.
  38. Printing an address of a variable in C
    Here, we are going to learn how to print the memory address of a variable in C programming language? To print the memory address, we use "%p" format specifier in C.
  39. printf() statement within another printf() statement in C
    Here, we are going to learn how to use and evaluate printf() statement within another printf() statement in C programming language?
  40. printf() examples/variations in C
    Here, we are going to learn about the printf(), its usages with different types of format specifiers in the C programming language?
  41. C program to calculate profit or loss
    Calculating profit and loss in C: Here, we are going to implement a C program that will calculate the profit and loss based on cost and selling price.
  42. Calculate the distance between two cities from kilometers to meters, centimeters, feet and inches using C program
    Calculating the distance in C: Here, we are implementing a C program that will input distance between two cities in kilometers and print the distance in meters, feet, and inches.
  43. C program to find area and perimeter of the rectangle
    Area and perimeter of rectangle in C: Here, we are going to learn how to find the area and perimeter of a rectangle using C program, where length and breadth are given.
  44. C program to generate random numbers within a range
    Generating random numbers in C: Here, we are going to learn how to generate random numbers within a given range in C programming language?
  45. C Example to subtract two integers without using Minus (-) operator
    In this example, we are going to learn how to subtract two integer number without using minus (-) operator in C language program? Here, we will use a bitwise complement to subtract the numbers.
  46. C Example for different floating point values prediction
    In this example, we are going to learn about float value’s behavior how they assigned and why they behave when comparing in C programs?
  47. C Example for nested 'printf'
    In this example, we will learn how to use nested printf statement in C program, how it works and what values will be printed?
  48. C program to get remainder without using % operator
    In this C program, we will learn how can we find the remainder of two integer numbers without using modulus (%) operator?
  49. C program to convert ascii to integer (atoi implementation)
    Here, we are going to learn how to convert ascii to integer (atoi implementation) in C programming language?
  50. C program to print ASCII table
    In this C program, we are going to print the characters with their ASCII codes? As we know that each character has some specific predefined code (ASCII - American Standard Code for Information Interchange), here we are printing those codes using a C program.
  51. C program to swap two numbers using four different methods
    In this C program, we are going to learn how to swap two integer numbers using different methods; here we are going to use four different methods?
  52. C program to check a given character is alphanumeric or not without using the library function
    Given a character, we have to check whether the given character is alphanumeric or not without using the library function.
  53. C program to check a given character is a digit or not without using the library function
    Given a character, we have to check whether the given character is a digit or not without using the library function.
  54. C program to check a given character is a whitespace character or not without using the library function
    Given a character, we have to check whether the given character is a whitespace character or not without using the library function.
  55. C program to check a given character is an uppercase character or not without using the library function
    Given a character, we have to check whether the given character is an uppercase character or not without using the library function.
  56. C program to check a given character is a lowercase character or not without using the library function
    Given a character, we have to check whether the given character is a lowercase character or not without using the library function.
  57. C program to check a given character is a punctuation mark or not without using the library function
    Given a character, we have to check whether the given character is a punctuation mark or not without using the library function.
  58. C program to check whether a character is a printable character or not without using library function
    Here, we are going to learn how to check whether a character is a printable character or not without using library function in C language?
  59. C program to convert a lowercase character into uppercase without using library function
    Here, we will read a lowercase character from the user and convert it into uppercase and print the result.
  60. C program to convert an uppercase character into lowercase without using library function
    Here, we will read an uppercase character from the user and convert it into lowercase.
  61. C program to print all punctuation marks without using library function
    Here, we will print all punctuation marks are available in C language without using any library function.
  62. C program to print all punctuation marks using the ispunct() function
    Here, we will print all punctuation marks available in C language using the ispunct() function.
  63. C program to print all printable characters using the isprint() function
    Here, we will print all printable characters available in C using the isprint() library function.
  64. C program to print all printable characters without using the library function
    In this program, we will print all printable characters are available in C without using the library function.
  65. C program to make a beep sound
    The "\a" escape sequence is used to make a beep sound i.e., it is used to generate a tone sound on the speaker. The beep sound can be used for the debugging or any other purpose.
  66. C program to convert a given number of days into days, weeks, and years
    Read the number of days from the user and convert it to years, weeks, and days using C program.
  67. C program to find the roots of a quadratic equation
    Read the value of a, b, and c, and calculate the roots of a quadratic equation.
  68. C program to find the GCD (Greatest Common Divisor) of two integers
    Read two integer numbers, and find the Greatest Common Divisor of given numbers.
  69. C program to find the LCM (Lowest Common Multiple) of two integers
    Read two integer numbers, and find the (LCM) Lowest Common Multiple of given numbers.
  70. C program to calculate the area of a triangle given three sides
    Read three edges of the triangle, and calculate the area of the triangle using the standard formula.
  71. C program to calculate the area of a triangle given base and height
    Read the base and height of the triangle from the user, and calculate the area of the triangle.
  72. C program to calculate the area of Trapezium
    Read the base1, base2, and height of Trapezium from the user, and then calculate the area of Trapezium.
  73. C program to calculate the area of the rhombus
    Read both diagonals of the rhombus from the user, and then calculate the area of the rhombus.
  74. C program to calculate the area of Parallelogram
    Read the values of base and altitude of Parallelogram from the user, and calculate the area of Parallelogram.
  75. C program to calculate the area of Cube
    Read the length of the side of Cube from the user, and calculate the area of Cube.
  76. C program to calculate the volume of Cube
    Read the length of the side of the Cube from the user, and calculate the volume of the Cube.
  77. C program to find the Surface Area and Volume of the Cylinder
    Read the radius and height of the cylinder from the user, and calculate the volume and surface area of the cylinder.
  78. C program to calculate the surface area, volume, and space diagonal of cuboids
    Read the height, width, and length of cuboids from the user, and calculate the surface area, volume, and space diagonal of cuboids.
  79. C program to calculate the surface area, volume of Cone
    Read the height and radius of a Cone from the user, and then calculate the surface area and volume of Cone.
  80. C program to calculate the surface area, volume of the Sphere
    Read the radius of Sphere from the user, and then calculate the surface area and volume of the Sphere.
  81. C program to calculate the mean, variance, and standard deviation of real numbers
    Create an array of real numbers and find the mean, variance, and standard deviation of numbers.
  82. C program to read coordinate points and determine its quadrant
    Read two coordinate points and determine their quadrant.
  83. C program to calculate the value of nCr
    Read the value of n and r and calculate the nCr.
  84. C program to calculate the value of nPr
    Read the value of n and r and calculate the nPr.
  85. C program to calculate the product of two binary numbers
    Read two integer numbers in binary format (1s and 0s) from the user, and then calculate the product of both numbers and print the result.
  86. C program to calculate the addition of two complex numbers
    Read two complex numbers from the user, and then calculate the addition of both complex numbers and print the result.
  87. C program to extract the last two digits from a given year
    Read the year from the user, and extract the last two digits, and print on the screen.
  88. C program to perform the ATM Transactions
    Here, we will implement an ATM transactions program that will perform the operations like check the balance, withdraw the amount, and deposit the amount to the bank.
  89. C program to read the height of a person and the print person is taller, dwarf, or average height person
    Here, we will create a double variable "height" and read its value from the user and print the person is taller, dwarf, or average height person.
  90. C program to read the grade of student print equivalent description
    Read the grade of the student from the user, and print an equivalent message.




Comments and Discussions!

Load comments ↻






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