7 Answers
New Answergets(num) is used to take string input containing spaces. So here scanf would be better.
#include <stdio.h> int main() { int num ; printf("Enter the value:"); scanf("%d",&num); switch (num) { case 1: case 2: case 3: printf("One, Two, or Three.\n"); break; case 4: case 5: case 6: printf("Four, Five, or Six.\n"); break; default: printf("Greater than Six.\n"); } }
Learn Playing. Play Learning
SoloLearn Inc.
4 Embarcadero Center, Suite 1455Send us a message