C program to convert temperature from Fahrenheit to Celsius or Celsius to Fahrenheit

#include<stdio.h> #include<conio.h> void main() { double temp,ctemp; int ch; clrscr();    //to clear the screen     printf(“Temprature Converrsion Menu”); printf(“nt1.Fahrenheit to Celsius”); printf(“nt2.Celsius to Fahrenheit”); printf(“nEnter your choice(1/2):”); scanf(“%d”,&ch); if(ch==1) { printf(“Enter Temperature in Fahrenheit:”); scanf(“%lf”,&temp); ctemp=(temp-32)/1.8; printf(“nTemprature in celcius is %lf”,ctemp); } else if(ch==2) { printf(“Enter Temperature in Celsius:”); scanf(“%lf”,&temp); ctemp=(1.8*temp)+32; printf(“nTemperature in Fahrenheit is

C program to convert temperature from Fahrenheit to Celsius or Celsius to Fahrenheit Read More »

C program that accepts marks in 5 subjects and outputs average marks

#include<stdio.h> #include<conio.h> void main() { int a,b,c,d,e,average; clrscr(); printf(“Enter marks of subject 1:”); scanf(“%d”,&a); printf(“Enter marks of subject 2:”); scanf(“%d”,&b); printf(“Enter marks of subject 3:”); scanf(“%d”,&c); printf(“Enter marks of subject 4:”); scanf(“%d”,&d); printf(“Enter marks of subject 5:”); scanf(“%d”,&e); average=(a+b+c+d+e)/5; printf(“nAverage=%d”,average); getch(); }

C program that accepts marks in 5 subjects and outputs average marks Read More »

C Program to Add Two Numbers

Here you will get simple C program to add two numbers. User will input two numbers, then their sum will be calculated and finally it will be printed on screen. The program is given below. C Program to Add Two Numbers  #include<stdio.h> int main() { int a,b,sum; printf(“Enter first number:”); scanf(“%d”,&a); printf(“Enter second number:”); scanf(“%d”,&b);

C Program to Add Two Numbers Read More »