//Algebraic Operations
#include<stdio.h>
#include<conio.h>
void main()
{
//Declaration of variables a and b along with sum,diff,pro and div
float a, b, sum, diff, pro, div;
clrscr();
printf("Enter any two integer values\n");
//Entry of variables a and b
scanf("%f%f",&a,&b);
//algebraic operations
sum = a + b;
diff= a - b;
pro = a * b;
//printing of output of addition, subtraction and product
printf("Sum = %.2f\n",sum);
printf("Difference= %.2f\n",diff);
printf("Product= %.2f\n",pro);
//controlling of division by zero using if else statement
if(b==0)
{
printf("Division is not Possible\n");
}
else
{
div = a / b;
printf("Division = %.2f\n",div);
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
//Declaration of variables a and b along with sum,diff,pro and div
float a, b, sum, diff, pro, div;
clrscr();
printf("Enter any two integer values\n");
//Entry of variables a and b
scanf("%f%f",&a,&b);
//algebraic operations
sum = a + b;
diff= a - b;
pro = a * b;
//printing of output of addition, subtraction and product
printf("Sum = %.2f\n",sum);
printf("Difference= %.2f\n",diff);
printf("Product= %.2f\n",pro);
//controlling of division by zero using if else statement
if(b==0)
{
printf("Division is not Possible\n");
}
else
{
div = a / b;
printf("Division = %.2f\n",div);
}
getch();
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.