C++ Program to calculate nPr & nCr. This program calculates the value of nCr and nPr. The values of n and r
are input by user. We have used 3 functions : 'npr' for calculating nPr ,
'ncr' for calculating nCr , factorial to calculate factorial. nPr is
calculated by the formula nPr = factorial(n)/factorial(n-r)
Welcome to " way2cplusplus.blogspot.in " Objective of this blog is to implement various Computer Science Engineering Lab problems into C++ programming language. These are basically most common Lab Exercise problems based on the curriculum of engineering colleges throughout the Nation. These lab exercises are also relevant to Data structure. Simply C++ programming zone...
Calculate Simple interest
C++ Program to calculate Simple Interest. This program calculates the simple interest and prints the result on the compiler screen.
Three values i.e principal amount(p), interest rate(r) & time period(t) are input by the user using 'cin'. All three are taken of 'float' type .
The formula for simple interest is : p*r*t/100.The result is shown on compiler screen using 'cout'.
Three values i.e principal amount(p), interest rate(r) & time period(t) are input by the user using 'cin'. All three are taken of 'float' type .
The formula for simple interest is : p*r*t/100.The result is shown on compiler screen using 'cout'.
Sum of G.P
C++ Program to calculate sum of finite G.P. This program calculates the sum of the a finite G.P. and prints the
result on the compiler screen. The first term 'a', number of terms 'n'
and the common ratio 'r' are input by the user. Sum of an G.P. is calculated by the formula : sum=(a*(1-pow(r,n+1)))/(1-r) , nth term by : nth=a*pow(r,n-1) . For loop is used to print the whole series
upto n
Calculate Sum of an A.P.
C++ Program to Calculate sum Of An A.P. series. This program calculates the sum of the an A.P. and prints the result on
the compiler screen. The first term 'a', number of terms 'n' and the
common difference 'd' are input by the user. Sum of an A.P. is
calculated by the formula : sum=(n*(2*a+(n-1)*d))/2 , nth term by : nth=a+(n-1)*d . For loop is used to print the whole series upto n and the sum is printed on compiler screen
calculated by the formula : sum=(n*(2*a+(n-1)*d))/2 , nth term by : nth=a+(n-1)*d . For loop is used to print the whole series upto n and the sum is printed on compiler screen
Calculate sum 1 + 2 + 3 +. . . .+n
C++ Program to calculate the sum of a series up to N terms.This program calculates the sum of the series 1 + 2 + 3 +. . . . . . . .
.+n and prints the result on the compiler screen. The last number n is
input by the user. Sum of this series is calculated by the formula :
sum=(n*(n+1))/2. For loop is used to print the whole series upto n and
the sum is printed on compiler screen.
Count Number of Vowels
C++ Program To count the number of Vowels in given string. This program calculates the number of vowels in a string using for loop.
The string is input by the user using gets(). Using gets() allows the
compiler to input the spaces of string also. We have taken a
variable count whose value increases by 1 when a vowel in encountered
during the scan. So value of count keeps on increasing
Inverse of a Matrix
C++ Program to Calculate the Inverse of matrix. This program finds the inverse of a matrix and prints the result on the
compiler screen. We define a 3-dimensional array 'a' of int type. It is
input by the user. The number of rows and columns are made fixed as 3.
Firstly determinant of the matrix is calculated using nested for loops
Multiply Matrices by Strassen's Method
C++ Program to multiply matrix using Strassen's
Multiplication method. This program calculates the multiplication of 2 matrices by Strassen's
Multiplication method. We define a 3 arrays : 'a' , 'b' & 'c' , all
of int type. All 3 are input by the user. The number of rows &
columns are made fix to 2. Then the multiplication is calculated by
using strassen's method and the new multiplied matrix is printed on the
screen.
QUEUE operations using Array
C++ Program for the implementation of Linear Queue operation (insert, delete & display). C++ Program to implement QUEUE operations using Array.
Queue is a abstract data type, In which entities are inserted into the rear end and deleted from the front end.
Queue based on the FIFO (First In First Out) criteria,means the element inserted first is get deleted first.
Queue based on the FIFO (First In First Out) criteria,means the element inserted first is get deleted first.
Stack Operations using arrays
C++ program for implementation of Stack (push,pop & display) operation.Stack based on the LIFO (Last In First Out) behavior means, the last
element is pushed(insert) inside the stack , is the first element to get
pop(deleted).Stack is a data structure in which the objects are arranged in a non linear order.
In stack, elements are added or deleted from only one end, i.e. top of the stack.
Here we implement the PUSH, POP, DISPLAY stack operations using the array.
check Armstrong number
C++ Program to check the input number is Armstrong number or not.
Armstrong number c++ program: A number is armstrong if the sum of cubes of individual digits of a number is equal to the number itself. For example 371 is an armstrong number as 33 + 73 + 13 = 371. Some other armstrong numbers are: 0, 1, 153, 370, 407.
Armstrong number c++ program: A number is armstrong if the sum of cubes of individual digits of a number is equal to the number itself. For example 371 is an armstrong number as 33 + 73 + 13 = 371. Some other armstrong numbers are: 0, 1, 153, 370, 407.
Transpose a matrix
C++ Program fot the Transpose of matrix.This c++ program prints transpose of a matrix. It is obtained by
interchanging rows and columns of a matrix. When we transpose a matrix then the order of matrix changes, but for a square matrix order remains same.
Convert Binary to Decimal or Decimal to Binary
C++ Program to convert Binary number to Decimal number or vice versa.This program converts either binary number entered by user to decimal
number or decimal number entered by user to binary number in accordance
with the character entered by user.This program asks user to enter alphabet 'b' to convert
Calculate Average Using Arrays
C++ Program to Calculate Average of n number, using array.This program takes n number of element from user(where, n is
specified by user), stores data in an array and calculates the average
of those numbers.This program calculates the average if the number of data are from 1 to 100. If user enters value of n above 100 or below 100 then, while loop is executed which asks user to enter value of n until it is between 1 and 100.
Count Number of Digits of an Integer
C++ program to count number of digit in an integer. This program takes an integer from user and calculates the number of
digits in that integer. For example: If user enters 2319, the output of
program will be 4 because it contains 4 digits.This program takes an integer from user and stores that number in variable n. Suppose, user entered 34523. Then, while loop is executed because
n!=0
will be true in first iteration. Find HCF of two number
C++ Program to find HCF of two number.
The largest integer which is perfectly divisible to two or more numbers is known as H.C.F or G.C.D of those two numbers.There are many ways to find the H.C.F of two numbers is C++ programming. Below code will take two integers from user and displays the H.C.F of those two integers.This is the best way to find HCF of two numbers.
The largest integer which is perfectly divisible to two or more numbers is known as H.C.F or G.C.D of those two numbers.There are many ways to find the H.C.F of two numbers is C++ programming. Below code will take two integers from user and displays the H.C.F of those two integers.This is the best way to find HCF of two numbers.
Swap two Numbers
C++ Program to Swap to integer value.This program asks user to enter two numbers and this program will swap the value of these two numbers.
Simply use oh three variable as shown in the program a, b & temp.
external variable temp is use to hold the value of a so that it can be use to assign value to b variable.
Simply use oh three variable as shown in the program a, b & temp.
external variable temp is use to hold the value of a so that it can be use to assign value to b variable.
Check number is Even or Odd
C++ Program to check the number is Even or Odd:Numbers perfectly divisible by 2 are known even numbers and numbers which are not divisible by 2 are called odd numbers.This program takes an integer from user and checks whether that number is even or odd and displays the result.In this program, user is asked to enter an integer which is stored in variable a.
Then, the remainder is found when that number is divided by 2 and
checked whether remainder is 0 or not.
Circular Linked List in C++
Program for the implementation of Circular Linked List in C++ language. In this program you can insert in circular link list, although the output seems as the singular link list but the code is written for circular list. Further addition if circular display function for viewing the operation don in the list. In Circular Linked List ending node not having the null value. Last node again point to starting node that's why it called as Circular Linked list.
Linked List Insert & Deletion operation in C++
Program for Linked List Insertion & Deletion Operation both done in same program using C++ language. So for easy access at all operation use of switch case is done in program. You can select one operation at a time. Total six operation is describe of insert & delete that is:-
1. Ins/Del at beg 2.Ins/Del at end 3.Ins/Del at specific location.
Further addition of display function for viewing the linked list.
1. Ins/Del at beg 2.Ins/Del at end 3.Ins/Del at specific location.
Further addition of display function for viewing the linked list.
Linked List Insert Operation in C++
Program for Insert element in Linked List using C++ language. Linked list has the dynamic memory allocation,thats why we can add n number of node in link list at our desire location.Simply use of three insertion operation done in this linked list program
1.Insert at beg 2.Insert at end
3.Insert at specific location
1.Insert at beg 2.Insert at end
3.Insert at specific location
Subscribe to:
Posts (Atom)