/*write a menu driven program to find out x^2,x^3,x^4, x^5 if x is a number, entre through keyboard*/ #include<stdio.h> #include<conio.h> #include<math.h> void main() { long int x,c,ans; clrscr(); printf("Enter Value of x:"); scanf("%ld",&x); printf("\n\n1.x^2\n2.x^3\n3.x^4\n4.x^5\n"); printf("\nEnter Your Choice:"); scanf("%ld",&c); switch(c) { case 1: ans=pow(x,2); printf("\nans:%ld",ans); break; case 2: ans=pow(x,3); printf("\nans:%ld",ans); break; case 3: ans=pow(x,4); printf("\nans:%ld",ans); break; case 4: ans=pow(x,5); printf("\nans:%ld",ans); break; default: printf("\nInvalid Choice"); break; } getch(); }
write a menu driven program to find out x^2,x^3,x^4, x^5 if x is a number, entre through keyboard
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment