Show Biggest
Show Biggest program
Make a program that receives 3 numbers and returns the biggest one.
Execute
Clone main branch from c-cpp-projects.
Access this folder on terminal:
Run with GCC compiler
With GCC compiler installed run the following commands:
-
Compile the
cppfile: -
Run the
executecompiled file:
Run with Docker
With Docker installed run the following commands:
-
Build the container and images:
-
Run the container with the built image
gcc-docker:latest:
Code
Code in C.
#include <stdio.h>
int main (void)
{
int n1,n2,n3, biggest;
printf("\nType the first number: \n");
scanf(" %d", &n1);
printf("\nType the second number: \n");
scanf(" %d", &n2);
printf("\nType the third number: \n");
scanf(" %d", &n3);
if (n1 > n2 && n1 > n3){
biggest = n1;
} else if ( n2 > n1 && n2 > n3){
biggest = n2;
} else if ( n3 > n1 && n3 > n2){
biggest = n3;
}
printf("\nBiggest:\n%d\n", biggest);
}
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.