-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkms_simple_loop.c
54 lines (37 loc) · 1.01 KB
/
kms_simple_loop.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
/*
* Converts distances from kilometers to miles
* or miles to kilometers
*/
#define _CRT_SECURE_NO_WARNINGS //for Visual Studio compiler
#pragma warning(disable:6031) //ignore scanf warnings
#include<stdio.h>
int main()
{
//declare variables to store the data
char again = 'y'; //initialization
printf("Welcome to the kilometer/ mile calculator. ");
while (again == 'y')//test
{
//calculation
printf("\nWould you like to do another conversion (y or n");
scanf(" %c", &again);//update
}
int userChoice;
int i;
//Initialization
i = 0;
while (i < 3)//test
{
printf("\nyou selected 1!\n");
//update
userChoice = 2;
}
printf("Welcome to the kilometer/ mile calculator. ");
while (again == 'y') //test
{
printf("\nWould you like to do another conversion? (y or n): ");
scanf(" %c", &again);
}
printf("\nHave a great day!\n");
return 0;
}