formatted files

This commit is contained in:
Rushil Umaretiya 2024-02-21 14:59:01 -05:00
parent 7ef18644e8
commit 5de9838a15
No known key found for this signature in database
GPG Key ID: 4E8FAF9C926AF959
4 changed files with 20 additions and 20 deletions

View File

@ -1,8 +1,8 @@
// PID: 730677144
// I pledge the COMP 211 honor code.
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char* argv[]) {
@ -21,7 +21,8 @@ int main(int argc, char *argv[]) {
int carry = 1;
for (int i = 31; i >= 0 && carry; i--) {
output[i] = (input[i] == '0') ? '1' : '0';
if (input[i] == '0') carry = 0;
if (input[i] == '0')
carry = 0;
}
} else {
int i = 31;

View File

@ -1,8 +1,8 @@
// PID: 730677144
// I pledge the COMP 211 honor code.
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[]) {
int num = atoi(argv[1]);

3
twos.c
View File

@ -1,8 +1,8 @@
// PID: 730677144
// I pledge the COMP 211 honor code.
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[]) {
int num = abs(atoi(argv[1]));
@ -20,7 +20,6 @@ int main(int argc, char *argv[]) {
} else {
out[15 - i] = '0';
}
}
if (argv[1][0] == '-') {