Wednesday, February 18, 2009

Exer 3

Output:


#include
#include

float num1,num2,sum=0,diff=0,pro=0,quo=0;
void main(){
clrscr();
gotoxy(25,4);textcolor(MAGENTA);cprintf("Basic Operations\n\n");
gotoxy(12,7);textcolor(CYAN);cprintf("Enter 1st number:");
scanf("%f", &num1);
gotoxy(12,8);textcolor(CYAN);cprintf("Enter 2nd number:");
scanf("%f", &num2);
sum=num1+num2;
gotoxy(15,11);textcolor(YELLOW);cprintf("Sum of %.2f and %.2f is %.2f",num1,num2,sum);
diff=num1-num2;
gotoxy(15,13);textcolor(YELLOW);cprintf("Difference of %.2f and %.2f is %.2f",num1,num2,diff);
pro=num1*num2;
gotoxy(15,15);textcolor(YELLOW);cprintf("Product of %.2f and %.2f is %.2f",num1,num2,pro);
quo=num1/num2;
gotoxy(15,17);textcolor(YELLOW);cprintf("Quotient of %.2f and %.2f is %.2f",num1,num2,quo);
getch();
}

No comments:

Post a Comment