/*write a menu driven program for x^2,x^3,x^4,x^5 of integer x*/ #include<stdio.h> #include<conio.h> #include<math.h> void main() { long int x,c,ans; clrscr(); printf("enter the value of x:"); scanf("%ld",&x); printf("\n1.x^2\n\n2.x^3\n\n3.x^4\n\n4.x^5"); printf("\n\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"); } getch(); }
write a menu driven program for x^2,x^3,x^4,x^5 of integer x
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment