Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- float add(float num1,float num2);
- float sub(float num1,float num2);
- float multiple(float num1,float num2);
- float division(float num1,float num2);
- int power(int num1);
- int main()
- {
- float n1,n2,result;
- scanf("%f %f",&n1,&n2);
- int option;
- scanf("%d",&option);
- switch(option)
- {
- case 1:
- result=add(n1,n2);
- printf("%f",result);
- break;
- case 2:
- result=sub(n1,n2);
- printf("%f",result);
- break;
- case 3:
- result=multiple(n1,n2);
- printf("%f",result);
- break;
- case 4:
- result=division(n1,n2);
- printf("%f",result);
- break;
- case 5:
- result=power(n1);
- printf("%f",result);
- break;
- }}
- float add(float num1,float num2)
- {
- return num1+num2;
- }
- float sub(float num1,float num2)
- {
- return num1-num2;
- }
- float multiple(float num1,float num2)
- {
- return num1*num2;
- }
- float division(float num1,float num2)
- {
- return num1/num2;
- }
- int power(int num1)
- {
- return pow(num1,2);
- }
Add Comment
Please, Sign In to add comment