COMPUTER September 08
COMPUTER September 08
f o r a i n . c
/****** F*************t**t******tt****ttt***************5
Online C Compiler.
Code, Compile, Run and Debug C program or
Write your code in this edi tor and press "Run" button to
*********************************************************
8 1/Milan Roy
9 1/Ro1l no.39
10 #include<stdio.h>
11 #include<string.h>
12 #define MAX 2
13 struct employee
14
5 char name[20];
int empid;
float salary;
18
19 int main()
20
21 struct employee e[MAX1:
int i;
for (i-0; i<MAX; i++)
24
25 printf("\nEnter details of employee %dn\n", i+1)
20
printfC"Enter employee name:);
27 Scanf("%s", e[i].name);
28 printtEnter employee 1d: ");
29 scanf(%d", &e[i].empid)D;
30 printf("Enter salary: ")
31 scanf("%f", &e[i].salary);
32
33
input
9TEP I 1ART
re nAyrà, i
3kp 4
EP
97 3: l i > Mn), go
.1
3.1 Rea tmplbpe namme, Emplsy ee id sala
,
inpu
ma1n.c: 37:9: warning : mpl1cit declaration of function 'getch
Onaec iarat10n ]
getch )
***
Enter the of
no:
student s3
Enter Student details 1
Enter student
nameMilan
Enter student rollno : 25
9TEP START
9fEP
1n, gs b sep 5
n a , Holl no.
amb masuk5
4.1 Road
o lal blat + ma k
it+
4.3
51E s10P
Run O Debug Stop G Share Save ( Beautify
main.c
for
Online C Compiler.
Code, Compile, Run and Debug C progr
5 Write your code in this editor and press "Run " butto
7 **************
***************************
8 / Milan Roy
9 1/Roll no. 35
10 #include <stdio. h>
11 struct Distance
2
3 int feet;
14 float inch;
15 d i s t 1 , dist2, sum;
main()
17 {
8
printf(" 1st distance\n")
9 printf("Enter feet: ");
0
scanf(%d", &dist1.feet)
21
22 printf("Enter inch: ");
23 scanf("%f", &dist1.inch);
24 printf("2nd distance \n")
25
26 printf("Enter feet: "):
27
scanf("%d", &dist2.feet);
28
29
printf(" Enter inch: ");
Scanf("%f", &dist2.inch);
30
31 // adding feet
32 sum.feet = dist1.feet dist2.feet;
3 adding inches
34 sum.inch = dist1.inch +dist2.inch
35
36 1 changing to feet if inch is greater than 12
37 while (sum. inch>= 12)
38 {
39 t+Sum.feet;
40 sum.inch = sum.inch 12
41
42 printf("Sum of distances = %d\"-%.1f\"", sum.fee
43
44
input
main )
1st distance
Enter feet : 10
Enter inch: 5
|2nd distance
Enter feet : 3
Enter inch: 7
9rEP GTART
amb
Read dst(ed, diy ind dr). re
91L0
d inth
9T6P 1 STDP