C++ Program to Print Table of Any Number
Here you will get C++ program to print table on any number. The user will enter a number and its table will be printed. Output Enter any number:6 6 * 1 = 6 6 * 2 = 12 6 * 3 = 18 6 * 4 = 24 6 * 5 = 30 6 …
Here you will get C++ program to print table on any number. The user will enter a number and its table will be printed. Output Enter any number:6 6 * 1 = 6 6 * 2 = 12 6 * 3 = 18 6 * 4 = 24 6 * 5 = 30 6 …
#include<iostream.h>#include<conio.h> void main(){ clrscr() //to clear the screen float a,b,c,sum,av; cout<<“Enter three numbers:”; cin>>a>>b>>c; sum=a+b+c; av=sum/3; cout<<“nSUM=”<<sum; cout<<“nAverage=”<<av; getch(); //to stop the screen}
#include<iostream.h> #include<conio.h> void main() { clrscr(); float a,b,res; int ch,q; cout<<“Arithmetic Operatios”; cout<<“nn1.Additionn2.Subtractionn3.Multiplicationn4.Divisionn5.Mode”; cout<<“n Enter your choice:”; cin>>ch; switch(ch) { case 1: { cout<<“nnEnter two variables:”; cin>>a>>b; res=a+b; cout<<“n Result=”<<res; } break; case 2: { cout<<“nnEnter two variables:”; cin>>a>>b; res=a-b; cout<<“n Result=”<<res; } break; case 3: { cout<<“nnEnter two variables:”; cin>>a>>b; res=a*b; cout<<“n Result=”<<res; } …
C++ Program to perform all arithmetic calculation using switch case Read More »
#include<iostream.h>#include<conio.h> void main(){ clrscr(); int i; for(i=1;i<=128;i*=2) cout<<i<<” “; getch();}
Here you learn how to check prime number in C++. Prime number is a number which is only divided by 1 or itself. Below is the C++ program to check whether a number is prime of not. Prime Number in C++ Output Enter any number:7 7 is a Prime number
Here you will get simple C++ program to find roots of quadratic equation ax2+bx+c=0. Output Quadratic Equation is ax^2+bx+c=0 Enter values of a,b and c:3 4 1 Two real and distinct roots Roots are -0.333333 and -1
#include<iostream.h>#include<conio.h> void main(){ clrscr(); //to clear the screen float temp,res; int choice; cout<<“Temperature Conversion”<<“nn 1.Fahrenheit to Celcius”; cout<<“n 2.Celcius to FahrenheitnnEnter your choice:”; cin>>choice; switch(choice){ case 1: { cout<<“nEnter temperature in Fahrenheit:”; cin>>temp; res=(temp-32)/1.8;} break; case 2: { cout<<“nEnter temperature in Celcius:”; cin>>temp; res=(temp*1.8)+32;} break; } cout<<“nConverted Temperature=”<<res; getch(); …
#include<iostream.h>#include<conio.h>#include<math.h> //for pow() function void main(){ clrscr(); int x,n,res; cout<<“Enter value of x and n:”; cin>>x>>n; res=pow(x,n); cout<<“nResult=”<<res; getch();}