Write a program that prompts the user to input three numbers

Write a program that prompts the user to input three numbers. The program should then output the numbers in ascending order.

Solution

#include <stdio.h>

#include <conio.h>

int a,b,c;

void main (){

printf(\"Please enter 3 integers\ \");

scanf(\"%d %d %d\", &a,&b,&c);

printf(\"The integers from smallest to largest are:\ \");

if (a>b) {

        if (b<c){

        printf(\"%d %d %d\", a,b,c);

        }

else if (a<c){

        printf(\"%d %d %d\", a,c,b);

        }

        else {

        printf(\"%d %d %d\", c,a,b);

        }

else{

        if (b>c){

        printf(\"%d %d %d\", c,b,a);

        }

        else if (b<c){

        printf(\"%d %d %d\", b,c,a);

        }

        else {

        printf(\"%d %d %d\", b,a,c);

        }

       }

       }

}

 Write a program that prompts the user to input three numbers. The program should then output the numbers in ascending order.Solution#include <stdio.h> #i

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site