University of Maiduguri: Department of Computer Engineering
University of Maiduguri: Department of Computer Engineering
University of Maiduguri: Department of Computer Engineering
FACULTY OF ENGINEERING
CPE 303:-
(Computer Programming Lab)
ID NUMBERS;
07/05/04/004
07/05/04/009
07/05/04/010
07/05/04/025
08/05/04/062
/*This is a standard Calculator Which can perform
Addition, Subtraction, Multiplication, Division,
give out the percentage of a number in another, e.t.c*/
#include<iostream.h>
#include<math.h>
#include<process.h>
void main()
{
float num1,num2,res,p=3.142; //These are variables that can accept decimal points
char ch,choice,count;
count=0;
z:
cout<<"\t\t\t\tSELECT OPERATION\n"<<endl;
cout<<"*****************************************************************
**************"<<endl;
cout<<"Press * for multiplication, + for addition, - for subtraction, / for division"<<endl;
cout<<"\np for percentage, r for square root, i for inverse, q for square, P for
power"<<endl;
cout<<"\nT for tan, S for sin, C for cos, t for tan inverse, s for sine inverse, \n\nc for cos
inverse"<<endl;
cout<<"*****************************************************************
**************\n"<<endl;
cin>>ch;
count++;
default:
cout<<"\nPlease select any of the above options\n"<<endl;
};
if(count==3)
{
cout<<"\nYou already used the program thrice...\n\nYou have to run the
program again...";
exit(0);
}
cout<<"\n::::::::::::::::::::::::::::::::::::::::"<<endl;
cout<<"Do you want perform another operation? (Press Y/N)"<<endl;
cout<<"::::::::::::::::::::::::::::::::::::::::\n"<<endl;
cin>>choice;
if((choice=='Y')||(choice=='y'))
{
goto z;
}
}
#include<iostream.h>
#include<conio.h>
#include<math.h>
int main()
{
int d,N,n=1;
float a,nth_term,Sn;
cout<<"\n\nThis Program Evaluate Arthmetic Progression"<<endl;
cout<<"\n\nTo calculate Enter the following"<<endl;
cout<<"\n\nFirst term(a),common difference(d),the Number of Terms(n)"<<endl;
cin>>a>>d>>N;
cout<<"\n\nThe Arthmetic Progression Is"<<endl;
if(n<=N)
{
nth_term=a+(n-1)*d;
n++;
cout<<"\t"<<nth_term<<"\t"<<endl;
}
cout<<"\n"<<endl;
Sn=(N/2)*(2*a+((N-1)*d));
cout<<"\n"<<endl;
cout<<"\nThe Sum of the first"<<N<<""<<"term is"<<""<<Sn<<endl;
return 0;
}