Skip to content

anonymous /printinincreasingorder.c
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
#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
Something went wrong with that request. Please try again.