## C++ program to find the greatest common divisor (GCD)

Source Code Code Explanation This program declares variables a and b of type int to hold the two numbers entered by the user. It then uses the cout object to print prompts asking the user to enter the two numbers and the cin object to read the numbers from the standard input stream. To find the GCD of the two ...

## C++ Program to Display Fibonacci Series

Source Code Code Explanation This program declares a variable n of type int to hold the number of terms entered by the user, and variables a and b of type int to hold the current and previous terms of the Fibonacci series, respectively. It then uses the cout object to print a prompt asking the user to enter the number ...

## C++ Program to Calculate Sum of Natural Numbers

Source Code Code Explanation This program declares a variable n of type int to hold the number of natural numbers, and a variable sum of type int to hold the sum of the natural numbers. It then uses the cout object to print a prompt asking the user to enter the number of natural numbers, and the cin object to ...

## C++ Program to Find All Roots of a Quadratic Equation

Source Code Code Explanation This program declares three variables a, b, and c of type double to hold the coefficients of the quadratic equation, and two variables x1 and x2 of type double to hold the roots of the equation. It then uses the cout object to print prompts asking the user to enter the coefficients and the cin object ...

## C++ Program to Find Largest Number Among Three Numbers

Source Code Code Explanation This program declares three variables num1, num2, and num3 of type int to hold the three numbers entered by the user. It then uses the cout object to print prompts asking the user to enter the numbers and the cin object to read the numbers from the standard input stream. To find the largest number, the ...

## C++ Program to Check Whether a character is Vowel or Consonant.

Source Code Code Explanation This program declares a variable c of type char to hold the character entered by the user. It then uses the cout object to print a prompt asking the user to enter a character, and the cin object to read the character from the standard input stream. To check if the character is a vowel, the ...

## Write a C++ Program to Swap Two Numbers.

This program declares two variables num1 and num2 to hold the two numbers entered by the user. It then uses the cin object to read the numbers from the standard input stream and the cout object to print the numbers before and after swapping. To swap the two numbers, the program uses a temporary variable temp to store the value ...