/Get Starting With C "Variables and Arithmetic operations" "continued"

## Get Starting With C "Variables and Arithmetic operations" "continued"

In the previous article , we started with variables and arithmetic operations
#include<stdio.h>
#include<math.h>
int main(void){
double num1 , num2 ;
num1 = 0;
num2 = 0;
printf(“enter the first number : “);
scanf(“%lf” , &num1);
printf(“enter the second number : “);
scanf(“%lf” , &num2);
printf(“the sum is %.3f \nthe difference is %.3f \n”,num1+num2 , num1-num2 );
printf(“the product is %.3f \nthe division is %.3f \n” , num1*num2 , num1/num2 );
printf(“number one power number two %.3f \n” , pow(num1 , num2) );
printf(“the square root of the first number %.3f \n” , sqrt(num1));
printf(“the square root of the second number %.3f \n” , sqrt(num2) );
}
HINT : this code will result an error if you tried to compile it with normal cc command , just put -lm also to link the math library to use the pow() and sqrt() functions.
Today , I’m going to apply the previous article on some problems , all of them is arithmetic problems.
here’s the code
#include<stdio.h>
int main(void){
float celisus , fahr; /* define two variables for celisus temp. and fahr. temp. */
printf(“enter the fahr degree : “);
scanf(“%f”,&fahr);
celisus = (5 * (fahr-32)) / 9 ;
printf(“the celisus degree is : %f” , celisus);
}
this is a code to conver from fahr degree into celisus degree
can you try to make it from celisus into kelvin ?!!
another problem
we want to calculate the salary of a person who’s working as an accountant with salary of 500\$ a month for 120 hours a month , the extra hour for 10\$ and if he exceeded 750\$ , his taxes will be 5% of the total salary . calculate his net salary.
here’s the code
#include<stdio.h>
int main(void){