View Code of Problem 78

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    char a[3][100],i;
    for(i=0;i<3;i++)
    {
        gets(a[i]);
    }
    char b[100];
    if(strcmp(a[0],a[1])>0)
    {
        strcpy(b,a[0]);
        strcpy(a[0],a[1]);
        strcpy(a[1],b);
    }
    if(strcmp(a[0],a[2])>0)
    {
        strcpy(b,a[0]);
        strcpy(a[0],a[2]);
        strcpy(a[2],b);
    }
    if(strcmp(a[1],a[2])>0)
    {
        strcpy(b,a[1]);
        strcpy(a[1],a[2]);
        strcpy(a[2],b);
    }
    int k;
    for(k=0;k<3;k++)
    {
        puts(a[k]);
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 78