Friday, 14 October 2016

Write a C Program to Simulate 3 Laws at Motion and convert Celsius to Fahrenheit and vice versa

2a:
Aim:a) Write a C Program to Simulate 3 Laws at Motion.

Program:-

#include<stdio.h>
void main()
{
int f,m,a;
printf("enter mass n accelration");
scanf("%d%d",&m,&a);
f=m*a;
printf("%d",f);
}



2b.c
Aim:- Write a C Program to convert Celsius to Fahrenheit and vice versa

Program:
#include<stdio.h>
void main()
{
                float f,c;
                printf("enter the temperature in centigrade\n");
                scanf("%f",&c);
                f=1.8*c+32;
                printf("\n %f centigrade=%f farenheat",c,f);
                printf("\n enter the temperature in farenheat");
                scanf("%f",&f);
                c=(f-32)/1.8;
                printf("\n %f farenheat=%f centigrade",f,c);

}

2 comments: