Skip to content

Instantly share code, notes, and snippets.

Created October 16, 2012 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3902683 to your computer and use it in GitHub Desktop.
Save anonymous/3902683 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
void userinput( void);
void increasingmath (void);
int first, second, third;
int main (int argc, const char * argv[]) {
userinput();
increasingmath();
return 0;
}
void userinput( void )
{
char nOne[50];
char nTwo[50];
char nThree[50];
printf("please type your first integer \n");
fgets(nOne, 50, stdin);
first = atoi(nOne);
printf("please type your second integer \n");
fgets(nTwo, 50, stdin);
second = atoi(nTwo);
printf("please type your third and final integer \n");
fgets(nThree, 50, stdin);
third = atoi(nThree);
}
void increasingmath( void)
{
if (second >= first)
{
if (third >= second)
{
printf("%d, %d, %d", first, second, third);
}
else
{
if (second >= third && third >= first)
{
printf("%d, %d, %d", first, third, second);
}
else
{
printf("%d, %d, %d",third, first, second);
}
}
}
else {
if (first >= second)
{
if (third <= second)
{
printf("%d, %d, %d", third, second, first);
}
else
{
if (second <= third && third <= first)
{
printf("%d, %d, %d", second, third, first);
}
else
{
printf("%d, %d, %d",second, first, third);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment