Blog

python tutorials and learn python

Created with Sketch.

C Program to Calculate the Sum of Natural Numbers

Unveiling the Sum of Natural Numbers in C: Looping Insights Introduction Calculating the sum of natural numbers is a fundamental task in mathematics and programming. It introduces us to the concept of loops, which are crucial for repetitive computations. In this blog post, we’ll explore and implement two different methods to find the sum of…
Read more

C Program to Check Whether a Character is an Alphabet or not

C Program to Check Whether a Character is an Alphabet or not In this example, you will learn to check whether a character entered by the user is an alphabet or not.   Example: Program to Check Alphabet   Output Enter a character: * * is not an alphabet In C programming, a character variable…
Read more

C Program to Check Whether a Number is Positive or Negative

C Program to Check Whether a Number is Positive or Negative In this example, you will learn to check whether a number (entered by the user) is negative or positive.   This program takes a number from the user and checks whether that number is either positive or negative or zero. Example #1: Check if…
Read more

C Program to Check Leap Year

C Program to Check Leap Year This program checks whether a year (integer) entered by the user is a leap year or not A leap year is exactly divisible by 4 except for century years (years ending with 00). The century year is a leap year only if it is perfectly divisible by 400. Example:…
Read more

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