chapter3
This commit is contained in:
BIN
test/a.out
Normal file
BIN
test/a.out
Normal file
Binary file not shown.
6
test/alert.c
Normal file
6
test/alert.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
printf("Alert!\a");
|
||||
return 0;
|
||||
}
|
24
test/test1.c
Normal file
24
test/test1.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void){
|
||||
|
||||
int num;
|
||||
int e = 1;
|
||||
int decimal = 0;
|
||||
|
||||
printf("%s\n", "Enter UNSIGNED BINARY! to convert decimal");
|
||||
scanf("%d", &num);
|
||||
int temp = num;
|
||||
|
||||
while (temp) {
|
||||
int last = temp % 10;
|
||||
temp = temp / 10;
|
||||
|
||||
decimal += last * e;
|
||||
e = e * 2;
|
||||
|
||||
}
|
||||
printf("%s %d\n", "Decimal: ", decimal);
|
||||
|
||||
return 0;
|
||||
}
|
13
test/test2.c
Normal file
13
test/test2.c
Normal file
@ -0,0 +1,13 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
int n = 4, a = 1;
|
||||
int i, c;
|
||||
for (i = 1; i <=n; i++) {
|
||||
for (c = 1; c <= i; c++) {
|
||||
printf("%d", a);
|
||||
a++;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user