-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWeather.c
More file actions
75 lines (71 loc) · 1.66 KB
/
Weather.c
File metadata and controls
75 lines (71 loc) · 1.66 KB
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
//
// Weather.c
//
//
// Created by Aditya Pudipeddi on 31/08/16.
//
//
#include <stdio.h>
int main()
{
int i,C,F,K;
printf("You are going to enter temprature according to which scale \n1.Celcius\n2.Farenheit\n3.Kelvin\nEnter 1,2 or 3 : ");
scanf("%d",&i);
switch (i)
{
case 1 :
printf("Enter the temprature: ");
scanf("%d",&C);
if (C < 0)
{
printf("Its Ice!!!");
}
else if (0 <= C & C <= 100)
{
printf("Its still water :)");
}
else
{
printf("Its steam :(");
}
break;
case 2 :
printf("Enter the temprature: ");
scanf("%d",&F);
C = (F-32) * (5/9);
if (C < 0)
{
printf("Its Ice!!!");
}
else if (0 <= C & C <= 100)
{
printf("Its still water :)");
}
else
{
printf("Its steam :(");
}
break;
case 3 :
printf("Enter the temprature: ");
scanf("%d",&K);
C = K + 273;
if (C < 0)
{
printf("Its Ice!!!");
}
else if (0 <= C & C <= 100)
{
printf("Its still water :)");
}
else
{
printf("Its steam :(");
}
break;
default :
{
printf("Cant you read! Enter a number between 1 and 3. Is it that difficult.");
}
}
}