Initial commit
5
Labs/Lab1/C/HelloWorld.c
Normal file
@ -0,0 +1,5 @@
|
||||
#include <stdio.h>
|
||||
int main() {
|
||||
printf("Hello world!\n");
|
||||
return 0;
|
||||
}
|
BIN
Labs/Lab1/C/HelloWorld.exe
Normal file
BIN
Labs/Lab1/Java/HelloWorld.class
Normal file
5
Labs/Lab1/Java/HelloWorld.java
Normal file
@ -0,0 +1,5 @@
|
||||
public class HelloWorld {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
BIN
Labs/Lab1/Lab1.pdf
Normal file
BIN
Labs/Lab1/Shoebottom_Isaac_Lab_1.docx
Normal file
5
Labs/Lab1/ToSort/Lab1/C/HelloWorld.c
Normal file
@ -0,0 +1,5 @@
|
||||
#include <stdio.h>
|
||||
int main() {
|
||||
printf("Hello world!\n");
|
||||
return 0;
|
||||
}
|
33
Labs/Lab1/ToSort/Lab1/CountOnes/countOnes.c
Normal file
@ -0,0 +1,33 @@
|
||||
#include <stdio.h>
|
||||
int main(){
|
||||
int value;
|
||||
int iErr;
|
||||
|
||||
printf("Value to examine: ");
|
||||
|
||||
iErr = scanf("%d",&value);
|
||||
|
||||
if(iErr != 1){
|
||||
printf("Unable to read the value\n");
|
||||
return 0;
|
||||
}
|
||||
if(value <= 0) {
|
||||
printf("Value must be positive\n");
|
||||
return 0;
|
||||
}
|
||||
int binaryArray[32];
|
||||
int arrayLength = 0;
|
||||
while(value > 0) {
|
||||
binaryArray[arrayLength] = value % 2;
|
||||
value = value/2;
|
||||
arrayLength++;
|
||||
}
|
||||
int counter = 0;
|
||||
for(int i = arrayLength; i >= 0; i--) {
|
||||
if (binaryArray[i] == 1) {
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
printf("Number of ones: %d\n", counter);
|
||||
return 0;
|
||||
}
|
5
Labs/Lab1/ToSort/Lab1/Java/HelloWorld.java
Normal file
@ -0,0 +1,5 @@
|
||||
public class HelloWorld {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
BIN
Labs/Lab1/ToSort/Lab1/Screenshot from 2021-09-15 11-01-22.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
Labs/Lab1/ToSort/Lab1/Screenshot from 2021-09-15 11-02-43.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
Labs/Lab1/ToSort/Lab1/Screenshot from 2021-09-15 11-15-44.png
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
Labs/Lab1/ToSort/Lab1/Screenshot from 2021-09-15 11-17-49.png
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
Labs/Lab1/ToSort/Lab1/Screenshot from 2021-09-15 11-18-50.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
Labs/Lab1/ToSort/Lab1/Screenshot from 2021-09-15 11-19-37.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
Labs/Lab1/ToSort/Lab1/Screenshot from 2021-09-15 11-21-26.png
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
Labs/Lab1/ToSort/Lab1/Screenshot from 2021-09-15 11-21-56.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
Labs/Lab1/ToSort/Lab1/Screenshot from 2021-09-15 11-22-26.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
Labs/Lab1/ToSort/Lab1/Shoebottom_Isaac_Lab1.zip
Normal file
BIN
Labs/Lab1/ToSort/Lab1/Shoebottom_Isaac_Lab_1.pdf
Normal file
33
Labs/Lab1/countOnes.c
Normal file
@ -0,0 +1,33 @@
|
||||
#include <stdio.h>
|
||||
int main(){
|
||||
int value;
|
||||
int iErr;
|
||||
|
||||
printf("Value to examine: ");
|
||||
|
||||
iErr = scanf("%d",&value);
|
||||
|
||||
if(iErr != 1){
|
||||
printf("Unable to read the value\n");
|
||||
return 0;
|
||||
}
|
||||
if(value <= 0) {
|
||||
printf("Value must be positive\n");
|
||||
return 0;
|
||||
}
|
||||
int binaryArray[32];
|
||||
int arrayLength = 0;
|
||||
while(value > 0) {
|
||||
binaryArray[arrayLength] = value % 2;
|
||||
value = value/2;
|
||||
arrayLength++;
|
||||
}
|
||||
int counter = 0;
|
||||
for(int i = arrayLength; i > 0; i--) {
|
||||
if (binaryArray[i] == 1) {
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
printf("Number of ones: %d", counter);
|
||||
return 0;
|
||||
}
|