Day: March 17, 2021

C Example for Beginners: C Program to Find LCM of two Numbers

(C programming Example for Beginners) C Program to Find LCM of two Numbers In this example, you will learn to calculate the LCM (Lowest common multiple) of two numbers entered by the user. The LCM of two integers n1 and n2 is the smallest positive integer that is perfectly divisible by both n1 and n2 (without a remainder). For example, the LCM of …

C Example for Beginners: C Program to Find GCD of two Numbers

(C programming Example for Beginners) C Program to Find GCD of two Numbers Examples on different ways to calculate GCD of two integers (for both positive and negative integers) using loops and decision making statements. The HCF or GCD of two integers is the largest integer that can exactly divide both numbers (without a remainder). …

C Example for Beginners: C Program to Check Whether a Character is an Alphabet or not

(C programming Example for Beginners) 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. In C programming, a character variable holds an ASCII value (an integer number between 0 and 127) rather …

C Example for Beginners: C Program to Check Whether a Number is Positive or Negative

(C programming Example for Beginners) 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. Check Positive or Negative Using …

C Example for Beginners: C Program to Find the Largest Number Among Three Numbers

(C programming Example for Beginners) C Program to Find the Largest Number Among Three Numbers In this example, you will learn to find the largest number among the three numbers entered by the user. Example 1: Using if Statement #include <stdio.h> int main(){ double n1, n2, n3; printf(“Enter three different numbers: “); scanf(“%lf %lf %lf”, …

C Example for Beginners: C Program to Check Whether a Character is a Vowel or Consonant

(C programming Example for Beginners) C Program to Check Whether a Character is a Vowel or Consonant In this example, you will learn to check whether an alphabet entered by the user is a vowel or a consonant. The five letters A, E, I, O and U are called vowels. All other alphabets except these 5 vowels are called consonants. This …

C Example for Beginners: C Program to Swap Two Numbers

(C programming Example for Beginners) C Program to Swap Two Numbers In this example, you will learn to swap two numbers in C programming using two different techniques. Swap Numbers Using Temporary Variable #include<stdio.h> int main(){ double first, second, temp; printf(“Enter first number: “); scanf(“%lf”, &first); printf(“Enter second number: “); scanf(“%lf”, &second); // Value of …