/* Program to find a^b using union to store the values of a, b and a b (for both int and/or float values of a and b) gcc program1.c -o test -lm */ #include< stdio.h > #include< math.h > union var { int a, b; float result; }; int main() { union var v; v.a=2; v.b=3; printf ("enter value for a: "); scanf("%d",&v.a); printf ("enter value for b: "); scanf("%d",&v.b); v.result=pow(v.a,v.b); printf (" a^b result : "); printf("%f\n", v.result); return 0; }