Adama Science and Technology University

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

ADAMA SCIENCE AND TECHNOLOGY UNIVERSITY

1………..
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b;
cout<<"\nEnter two numbers : ";
cin>>a>>b;
a=a+b;
b=a-b;
a=a-b;
cout<<"\nAfter swapping :";
cout<<a<<" "<<b;
}
2…………
#include <iostream.h>
#include<conio.h>
using namespace std;
void main(){
char ch;
cout<<"\nEnter any character :";
cin>>ch;
ch++;
cout<<"Next Character is:"<<ch;
//this program was written by
//Gezahegn Tadesse UGR/25771/14
}

3………….
#include <iostream.h>
#include <cmath>
int main()
{
int x;
std::cin>>x;//Enter value of x
std::cout<<"Absolute of "<<x;
std::cout<<" is\n="<<abs(x);
return 0;
}
4…………..
#include<iostream.h>
#include<cmath>
void main()
{
int Anteneh_age,Ruta_age,Jemal_age;
cout<<"Enter Anteneh age:";
cin>>Anteneh_age;
cout<<"Enter Ruta age:";
cin>>Ruta_age;
cout<<"Enter Jemal age:";
cin>>Jemal_age;
if (Anteneh_age<Ruta_age && Anteneh_age<Jemal_age)
cout<<"Anteneh is youngest";
else if(Ruta_age<Anteneh_age && Ruta_age<Jemal_age)
cout<<"Ruta is youngest";
else
cout<<"Jemal is youngest";
}//Gezahegn Tadesse UGR/25771/14
6………..
#include<iostream.h>
#include<conio.h>
void main ()
{
char ch;
cout<<"Enter any character:";
cin>>ch;
if (ch>=65 && ch<=90)
cout<<"Character is a capital letter";
else if (ch>=97 && ch<=122)
cout<<"Character is a small letter";
else if (ch>=48 && ch<=57)
cout<<"Character is a digit";
else if ((ch>0 && ch<=47)||(ch>=58 && ch<=64)||(ch>=91 &&
ch<=96)||(ch>=123 && ch<=127))
cout<<"Character is a special symbol";
getch();
}

You might also like