-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain (6).c
80 lines (68 loc) · 2.09 KB
/
main (6).c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
struct employee {
char name[50];
int empId ;
float CTC;
};
int main()
{
struct employee s1 , s2 , s3;
printf("Enter Your name , EmpId , Salary: \n");
scanf("%s" , s1.name);
scanf("%d" , &s1.empId);
scanf("%f" , &s1.CTC);
printf("Enter Your name: \n");
scanf("%s" , s2.name);
printf("Enter your Employee ID: \n");
scanf("%d" , &s2.empId);
printf("Enter your salary: \n");
scanf("%f" , &s2.CTC);
printf("Enter Your name: \n");
scanf("%s" , s3.name);
printf("Enter your Employee ID: \n");
scanf("%d" , &s3.empId);
printf("Enter your salary: \n");
scanf("%f" , &s3.CTC);
for(int i = 0 ; i < 3; i++)
{
for(int j = i + 1; j < 3; j++)
{
if(s1.CTC < s2.CTC )
{
int temp ;
temp = s1.CTC;
s1.CTC = s2.CTC;
s2.CTC = temp;
}
if(s2.CTC < s3.CTC)
{
int temp ;
temp = s2.CTC;
s2.CTC = s3.CTC;
s3.CTC = temp;
}
if(s1.CTC < s3.CTC)
{
int temp ;
temp = s1.CTC;
s1.CTC = s3.CTC;
s3.CTC = temp;
}
}
}
printf("Your name is %s\n" , s1.name);
printf("Your Employee ID is %d\n" , s1.empId);
printf("Your salary is %f\n" , s1.CTC);
printf("Your name is %s\n" , s2.name);
printf("Your Employee ID is %d\n" , s2.empId);
printf("Your salary is %f\n" , s2.CTC);
printf("Your name is %s\n" , s3.name);
printf("Your Employee ID is %d\n" , s3.empId);
printf("Your salary is %f\n" , s3.CTC);
return 0;
}