1.
#include<stdio.h>
int main()
{
printf("Programming in C is fun!\n");
return 0;
}
2.
#include<stdio.h>
int main()
{
printf("* * * *\n");
printf(" * * *\n");
printf(" * *\n");
printf(" *\n");
return 0;
}
3.
#include<stdio.h>
int main()
{
int F=150;
printf("fahr = 150, celsius = %d\n",5*(F-32)/9);
return 0;
}
4.
#include<stdio.h>
#include<math.h>
int main()
{
int g=10;
int t=3;
printf("height = %.2lf\n",(double)(g/2*(int)pow(t,2)));
retrun 0;
}
5.
#include<stdio.h>
int main()
{
int c;
scanf("%d\n",&c);
printf("Celsius = %d\n",5*(c-32)/9);
return 0;
}
6.
#include<stdio.h>
int main()
{
int m,n;
scanf("%d %d\n",&m,&n);
if(n!=0){
printf("%d + %d = %d\n",m,n,m+n);
printf("%d - %d = %d\n",m,n,m-n);
printf("%d * %d = %d\n",m,n,m*n);
printf("%d / %d = %d\n",m,n,m/n);
}
return 0;
}
7.
#include<stdio.h>
int main()
{
double x;
scanf("%lf\n",&x);
if(x==0) printf("f(%.1lf) = %.1lf\n",x,x);
else printf("f(%.1lf) = %.1lf\n",x,1/x);
return 0;
}
8.