-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1F.c
68 lines (51 loc) · 1.84 KB
/
1F.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
#include <stdio.h>
#include <string.h>
int questionThree(){
/*Write a C program the convertes the number of minutes to
days and years.*/
int min;
printf("INPUT MINUTES: ");
scanf("%d" ,&min);
float days = min / 24;
float years = min / 525600;
printf("%d minutes in %.0f days and %.1f years\n", min, days, years);
}
int questionTwo(){
/*Designa a program using conditional operators what will evaluate
if the number entered is positive or negative*/
int userInput;
printf("INPUT NUMBER: ");
scanf("%d", &userInput);
if(userInput >= 0){
printf("The number entered %d is positive\n", userInput);
}else{
printf("The number entered %d is negative\n", userInput);
}
return 0;
}
int questionOne(){
/*Create a program that automatically generate a student's biodata
on his/her inputted infor. Information will be Student Name, School,
Department, Course, Year and Section. Address and Mobile Number*/
char studentName[50], school[50], department[50], course[50], Year[50], Section[50];
printf("Input the ff information\n+\tName\n+\tSchool\n+\tDepartment\n+\tCourse\n+\tYear\n+\tSection\n");
printf("E.g. John EVSU COE BSIT 1st 1F\n");
scanf("%s%s%s%s%s%s", studentName, school, department, course, Year, Section);
printf("\n+\tName: %s\n+\tSchool: %s\n+\tDepartment: %s\n+\tCourse: %s\n+\tYear: %s\n+\tSection: %s\n", studentName, school, department, course, Year, Section);
return 0;
}
int main(){
int input;
printf("Type the number of the question you want to run: ");
scanf("%d", &input);
if(input == 1){
questionOne();
}
else if(input == 2){
questionTwo();
}
else if(input == 3){
questionThree();
}
return 0;
}