₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,344,168 members, 8,510,496 topics. Date: Friday, 30 October 2026 at 01:39 PM

Toggle theme

C Programming Help Needed - Programming - Nairaland

Nairaland Forum › Science/Technology › Programming › C Programming Help Needed (783 Views)

1 Reply

C Programming Help Needed by cruworld(op): 7:19pm On Dec 17, 2009
/* Demonstrates the use of if statements */

#include <stdio.h>

int main( void )
{
   
 int x, y;
/* Input the two values to be tested */

printf("\nInput an integer value for x: "wink;
scanf("%d",&x);
fflush(stdin);


printf("\nInput an integer value for y:"wink;
scanf("%d", &y);
fflush(stdin);

/* Test values and print result */
switch( x,y )
{
case 1: x == y ;
printf("x equal y\n"wink;

case 2:x > y;
printf("x is greater than y\n"wink;
break;
case 3: x < y;
printf("x is smaller than y\n"wink;
break;

break;
}

getchar();
return 0;
}


Why is my program not returnin output for case 1: x == y ;
printf("x equal y\n"wink; huh?
Re: C Programming Help Needed by Cockyzy(m): 8:17pm On Dec 17, 2009
Guy,try put break after your 1st case statement and also create the default case too.Use IF If u can get it done
1 Reply

C Programming Help • [Programming Help] Html Experts Urgently Needed • 2 • 3 • 4

Softwares • Java Tutorial • Programmer In The House I Need Help On How To Set Up Java With Window 7.