Wednesday, 9 April 2014
write program that inputs divident and divisor.it then calculate and displays the quotient and remainder
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#include<iostream.h> #include<conio.h> void main(){ int div ,dis, q , r; clrscr(); cout<<enter divident "; cin>>div; cout<<enter divisor "; cin>>dis; q=div/dis; r=div%dis; cout<<"quotient="<<q<<endl; cout<<"remainder="<<r; getch(); } |
OUTPUT
Wednesday, 9 April 2014 by gul ahmad · 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include<iostream.h> #include<conio.h> void main(){ clrscr(); int a,b; int sum; cout<<"Enter any two integers:\n "; cout<<"Enter first integers= "; cin>>a; cout<<"Enter second integers= "; cin>>b; sum = a - (-b); //sum = a - ~b -1; cout<<"Sum of two integers:"<<sum; getch(); } |
OUTPUT
by gul ahmad · 0
1 2 3 4 5 6 7 8 9 10 11 12 13 | #include<iostream.h> #include<conio.h> void main(){ clrscr(); int n; n=1; while(n<=5) { cout<<n<<"\t"<<n*n<<endl; n++; } getch(); } |
OUTPUT
by gul ahmad · 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include<iostream.h> #include<conio.h> void main(){ clrscr(); int n=1,sum=0; while(n<=5) { cout<<n<<endl; sum=sum+n; n=n+1; } cout<<"sum is="<<sum; getch(); } |
OUTPUT
by gul ahmad · 0
1 2 3 4 5 6 7 8 9 10 11 12 |
#include<iostream.h>
#include<conio.h>
void main(){
int n;
n=10;
while(n>=1)
{
cout<<n<<endl;
n=n-1;
}
getch();
}
|
OUTPUT
by gul ahmad · 0
Subscribe to:
Comments (Atom)