C++ Program to perform all arithmetic calculation using switch case

#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 »

Prime Number in C++

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

C++ Program for temperature conversion which converts fahrenheit to celcius or celcius to fahrenheit depending upon user's choice

#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(); …

C++ Program for temperature conversion which converts fahrenheit to celcius or celcius to fahrenheit depending upon user's choice Read More »