-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab6.c
51 lines (45 loc) · 1.17 KB
/
lab6.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
/*Max Waldt
Lab 6: Intro to C
CSC 311
4/2/15
*/
#include <stdio.h>
int main(){
//part 1
int input1;
int input2;
int input3;
int result;
int fiveDigit;
int intAtIndex;
int intMag = 10000;
int index = 0;
char intPrints[6];
printf("Input 3 integers, one at a time for operation int1*int2 - int3\n");
printf("input first int: ");
scanf("%d", &input1);
printf("\ninput second int: ");
scanf("%d", &input2);
printf("\ninput third int: ");
scanf("%d", &input3);
result = input1 * input2 - input3;
printf("\nResult of operation: %d", result);
//part 2
printf("\n\n--------\nThis is a C Program");
printf("\n--------\nThis is\n a C Program");
printf("\n--------\nThis\nis\na\nC\nProgram");
printf("\n--------\nThis\tis\ta\tC\tProgram");
printf("\n--------\n*****\n****\n***\n**\n*");
//part 3
printf("\n\nInput a 5 digit integer: ");
scanf("%d", &fiveDigit);
printf("\n\n");
for(index = 0; index < 5; index ++){
intAtIndex = fiveDigit / intMag;
fiveDigit = fiveDigit - intMag*intAtIndex;
intMag = intMag /10;
printf("%d", intAtIndex);
printf(" ");
}
printf("\n");
}