Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Test123
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added test123 to test fork repo
23 changes: 23 additions & 0 deletions big3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <stdio.h>

biggest3() {

double n1, n2, n3;

printf("Enter three different numbers: ");
scanf("%lf %lf %lf", &n1, &n2, &n3);

// if n1 is greater than both n2 and n3, n1 is the largest
if (n1 >= n2 && n1 >= n3)
printf("%.2f is the largest number.", n1);

// if n2 is greater than both n1 and n3, n2 is the largest
if (n2 >= n1 && n2 >= n3)
printf("%.2f is the largest number.", n2);

// if n3 is greater than both n1 and n2, n3 is the largest
if (n3 >= n1 && n3 >= n2)
printf("%.2f is the largest number.", n3);

// return 0;
}
19 changes: 19 additions & 0 deletions fact.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <stdio.h>
factorial() {
int n, i;
unsigned long long fact = 1;
printf("Enter an integer: ");
scanf("%d", &n);

// shows error if the user enters a negative integer
if (n < 0)
printf("Error! Factorial of a negative number doesn't exist.");
else {
for (i = 1; i <= n; ++i) {
fact *= i;
}
printf("Factorial of %d = %llu", n, fact);
}

// return 0;
}
4 changes: 4 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
main() {
biggest3();
factorial();
}
12 changes: 12 additions & 0 deletions makefile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ABC.exe:main.o big3.o fact.o
gcc -o ABC.exe main.o big3.o fact.o


main.o:main.c
gcc -c main.c

big3.o:big3.c
gcc -c big3.c

fact.o:fact.c
gcc -c fact.c