Você está na página 1de 4

Program # A: Task: (a) Rameshs basic salary is input through the keyboard.

His dearness
allowance is 40% of basic salary , and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.
#include<stdio.h> #include<conio.h> void main(void) { Int bas_sal; float d_al, h_rent, gross_sal; clrscr(); printf(Please enter Ramesh's basic Salary); scanf(%d, &bas_sal); med_al = 0.4*bas_sal; h_rent = 0.2*bas_sal; gross_sal= b_sal + d_al + h_rent; printf(Ramesh's Gross Salary=%f, gross_sal); getch(); }

OUTPUT:

Program # B: Task:

(a)The distance between two cities (in km) is input through the
keyboard. Write a program to convert and print this distance in meters, feet, inches and centimeter.
#include<stdio.h> #include<conio.h> void main(void) { clrscr(); int km; long int m,ft,in,cm; printf("enter the distance between cities in km\n"); scanf("%d",&km); m=km*1000; ft=m*3; in=ft*12; cm=m*100; printf("m=%ld\n",&m); printf("ft=%ld\n",&ft); printf("in=%ld\n",&in); printf("cm=%ld\n",&cm); getch(); }

OUTPUT:

Program # C: Task: (b) If the marks obtained by a student in five different subjects are
input through the keyboard, find out the aggregate marks and percentage marks obtained by the student. Assume that the maximum marks that can be obtained by a student in each subject is 100.
#include<stdio.h> #include<conio.h> void main(void) { clrscr(); int eng,math,pst,sci,comp,agg_marks; float percent; printf("Enter the marks of eng"); scanf("%d",&eng); printf("Enter the marks of math"); scanf("%d\n",&math); printf("Enter the marks of Pst"); scanf("%d\n",&pst); printf("enter the marks of sci"); scanf("%d\n",&sci); printf("Enter the marks of comp"); scanf("%d\n",&comp); agg_marks=eng+math+pst+sci+comp; percent=agg_marks*100.0/500.0; printf("agg_marks=%d\n",agg_marks); printf("percent=%f\n",percent); getch(); }

OUTPUT:

Program # d: Task: (c) Temperature of a city in Fahrenheit degrees is input through the keyboard.
Write a program to convert this temperature into centigrade degrees. #include<stdio.h> #include<conio.h> void main(void) { clrscr(); int F_temp; float C_temp; printf("Enter the temp of city in Deg fahrenheit: "); scanf("%d",&F_temp); C_temp=(F_temp-32)*5/9; printf("Temp in deg centigrade=%f",C_temp); getch(); }

OUTPUT:

Você também pode gostar