#include<stdio.h>
float simpleCalc(float,float,int); // Function prototype
int main()
{
float L,M;
L = simpleCalc(4,5,1); // function call
printf("%f\n",L);
return 0;
}
float simpleCalc(float A,float B,int C)
{
if (C==1)
{
return A+B;
}
else if (C==2)
{
return A-B;
}
else if (C==3)
{
return A*B;
}
else if (C==4)
{
return A/B;
}
else
{
printf("Wrong input!!\n");
}
}
#include<stdio.h>
float simpleCalc(float,float,int);
int main()
{
float L,M;
L = simpleCalc(4,5,1);
printf("%f\n",L);
return 0;
}
float simpleCalc(float A,float B,int C)
{
if (C==1)
{
return A+B;
}
else if (C==2)
{
return A-B;
}
else if (C==3)
{
return A*B;
}
else if (C==4)
{
return A/B;
}
else
{
printf("Wrong input!!\n");
}
}
float simpleCalc(float,float,int);
int main()
{
float L,M;
L = simpleCalc(4,5,1);
printf("%f\n",L);
return 0;
}
float simpleCalc(float A,float B,int C)
{
if (C==1)
{
return A+B;
}
else if (C==2)
{
return A-B;
}
else if (C==3)
{
return A*B;
}
else if (C==4)
{
return A/B;
}
else
{
printf("Wrong input!!\n");
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.