To calculate y raised to power x
Topics Covered:
- To read temperature in Fahrenheit and convert it into Celsius
- To calculate y raised to power x
- To swap the value of two variables
//to read temperature in fahrenheit and convert it into celsius
#include<conio.h>
#include<stdio.h>
int main()
{
float f,c;
printf(“enter the temerature in fahrenheit\n”);
scanf(“%f”,&f);
c=(f-32)*0.5556;
printf(“temperature in celsius=%f”,c);
return 0;
}
//to calculate y raised to power x
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
int x,y,p;
printf(“enter the values for base and power”);
scanf(“%d%d”,&x,&y);
p=pow(x,y);
printf(“product=%d”,p);
return 0;
}
//to swap the value of two variables
#include<conio.h>
#include<stdio.h>
int main()
{
int a,b,c;
printf(“enter two values for a and b”);
scanf(“%d%d”,&a,&b);
printf(“before swapping\n”);
printf(“a=%d\n”,a);
printf(“b=%d\n”,b);
c=a;
a=b;
b=c;
printf(“after swapping\n”);
printf(“a=%d\n”,a);
printf(“b=%d”,b);
return 0;
}