let rec pow (a: int) (b: int) : int :=
if b=0 then 1
else a * pow a (b-1)
(a) What is the name assigned to this function?
(b) What are the parameters defined to this function?
(c) What type of function is this?
Answers
#include <stdio.h>
int main(){
char wish;
float num1,num2,result;
int flag =1;
printf(" Enter - , + , * ,/ for knowing result \n");
scanf("%c" , &wish);
printf ("Enter number 1\n");
scanf("%f", &num1 );
printf ("Enter number 2\n");
scanf("%f" , &num2 );
switch (wish)
{
case '+':
result =num1+num2;
break ;
case'-':
result =num1-num2;
break ;
case '/':
{
if (num2 ==0)
{
flag = 0;
}
else
{
result =num1/num2;
}
break ;
}
case'*':
result = num1 *num2;
break ;
default : printf ("error");
break ;
}
if (flag ==1)
{
printf ("%f %c %f =%f" , num1, wish,num2 ,result );
}
else
{
printf ("%f %c %f = undefined" ,num1 ,wish ,num2 );
}
}
-------m ---- it hl-----------p--------s--------- u-------u------------u