Can someone help me with what I'm doing wrong. I'm getting "parse error before else" on the 19, 25, and 31 line.
Here is the assignment:Write a C program that takes as input three integers and then outputs them in sorted (ascending) order. Save your program in a file called p1.c. You don't have to handle the case with invalid inputs.
Code:#include <stdio.h> int main(void) { int a, b, c, first, second, max; printf("Enter Number 1: \n"); scanf("%d", &a); printf("Enter Number 2: \n"); scanf("%d", &b); printf("Enter Number 3: \n"); scanf("%d", &c); if ( a > b && a > c ) max=a; else if ( b > a && b > c ) max=b; else if ( c > a && c > b ) max=c; if ( max=a ) { if ( b > c ) first= c; second= b; else first= b; second= c; } if ( max=b ) { if ( a > c ) first= c; second= a; else first= a; second= c; } if ( max=c ) { if ( a > b ) first= b; second= a; else first= a; second= b; } printf("%d\n", first); printf("%d\n", second); printf("%d", max); return 0; }



LinkBack URL
About LinkBacks


