Category: C program

python tutorials and learn python

Created with Sketch.

C Program to Find All Roots of a Quadratic Equation

In this program, we declare double variables “a”, “b”, and “c”, which represent the coefficients of the quadratic equation. We prompt the user to enter these values using the “scanf” function. We then calculate the discriminant of the quadratic equation using the formula “b^2 – 4ac”. If the discriminant is greater than 0, it means…
Read more

C Program to Find the Largest Number Among Three Numbers

C Program to Find the Largest Number Among Three Numbers In this example, the largest number among three numbers (entered by the user) is found using three different methods. This program uses only if statement to find the largest number. Example #1 This program uses nested if…else statement to find the largest number. This program…
Read more

C Program to Check Whether a Character is Vowel or Consonant

C Program to Check Whether a Character is a Vowel or Consonant In this example, if…else statement is used to check whether an alphabet entered by the user is a vowel or a constant. The five alphabets A, E, I, O and U are called vowels. All other alphabets except these 5 vowel letters are…
Read more

C Program to Check Whether a Number is Even or Odd

C Program to Check Whether a Number is Even or Odd In this example, if…else statement is used to check whether a number entered by the user is even or odd. An even number is an integer that is exactly divisible by 2. Example: 0, 8, -24 An odd number is an integer that is…
Read more

C Program to Swap Two Numbers

C Program to Swap Two Numbers This example contains two different techniques to swap numbers in C programming. The first program uses a temporary variable to swap numbers, whereas the second program doesn’t use temporary variables. Example 1: Program to Swap Numbers Using Temporary Variable   Output Enter first number: 1.20 Enter second number: 2.45…
Read more

C Program to Demonstrate the Working of Keyword long

C Program to Demonstrate the Working of Keyword long The long is a size modifier, indicated by the keyword long, that may increase the size of a variable during declaration. This program will demonstrate the working of the long keywords. Example: Program to Demonstrate the Working of long   Output Size of int = 4…
Read more

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

C Program to Find the Size of int, float, double and char This program declares 4 variables of type int, float, double and char. Then, the size of each variable is evaluated using sizeof the operator. Example: Program to Find the Size of a variable   Output Size of int: 4 bytes Size of float:…
Read more

C Program to Compute Quotient and Remainder

C Program to Compute Quotient and Remainder This program evaluates the quotient and remainder when an integer is divided by another integer. Program to Compute Quotient and Remainder   Output Enter dividend: 25 Enter divisor: 4 Quotient = 6 Remainder = 1 In this program, the user is asked to enter two integers (dividend and…
Read more

C Program to Find ASCII Value of a Character

C Program to Find ASCII Value of a Character In C programming, a character variable holds an ASCII value (an integer number between 0 and 127) rather than the character itself. You will learn how to find the ASCII value of a character in this program. A character variable holds an ASCII value (an integer…
Read more

C Program to Multiply two Floating Point Numbers

C Program to Multiply two Floating Point Numbers In this program, the user is asked to enter two numbers (floating point numbers). Then, the product of those two numbers is stored in a variable and displayed on the screen.   Program to Multiply Two Numbers Output Enter two numbers: 2.4 1.12 Product = 2.69 In…
Read more