#include<stdio.

h> float float float float add(float,float); sub(float,float); product(float,float); divide(float,float);

void main() { float n1,n2; char sym,choice; printf("This Program is a program for calculator\n\n"); scanf("%f%c%f",&n1,&sym,&n2); if(sym=='+') printf("\n%f",add(n1,n2)); if(sym=='-') printf("\n%f",sub(n1,n2)); if(sym=='*') printf("\n%f",product(n1,n2)); if(sym=='/') printf("%f",divide(n1,n2)); printf("\nDo you wish to continue[y/n]"); scanf("%s",&choice); if(choice=='y'||choice=='Y') main(); } float add(float m1,float m2) { return(m1+m2); } float sub(float m1,float m2) { return(m1-m2); } float product(float m1,float m2) { return(m1*m2); } float divide(float m1,float m2) { return(m1/m2); }

Sign up to vote on this title
UsefulNot useful