#include<stdio.h>
#include<conio.h>
#include<math.h>
float power(float n);
float sqroot(float n);
main()
{
float n;
int c;
printf("Enter number : ");
scanf("%f",&n);
printf("Please select choice( 1=power, 2=square root) : ");
scanf("%d",&c);
if(c==1)
{
power(n);
}
else if(c==2)
{
sqroot(n);
}
else
{
printf("Menu Error!!");
}
getch();
}
float power(float n)
{
float mypow;
mypow=pow(n,2);
printf("Result = %.2f ",mypow);
return(mypow);
}
float sqroot(float n)
{
float mysqrt;
mysqrt=sqrt(n);
printf("Result = %.2f ",mysqrt);
return(mysqrt);
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น