Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,826 members, 7,813,741 topics. Date: Tuesday, 30 April 2024 at 05:17 PM

C Programming Help Needed - Programming - Nairaland

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

C Programming Help / [Programming Help] Html Experts Urgently Needed (2) (3) (4)

(1) (Reply)

C Programming Help Needed by cruworld(m): 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; ?
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)

Any Idea On How To Limit Download / Help On Java Study / Facts Need To Know

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 7
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.