Using switch statement, how can i create a program that ask the user to enter choices 1,2 or 3 only and do the problem below? SAMPLE OUTPUT *********CHOICES********* [1] number to roman [2] 12hour to 24hour clock [3] exit ************************* ENTER YOUR CHOICE:4 INVALID. (Terminated) ENTER YOUR CHOICE:1 [1] Conversion Create a program that prompts the user to enter a number (from 1-3000 only) then output the number and its corresponding roman numeral number. [2] 12Hr clock 24Hr clock Create a program that will prompt the user to input time based on a 12-hour clock and output the corresponding time based on a 24-hour clock. Check all possible invalid input data.
Code: printf("[display menu]"); char buf[32]; fgets(buf,30,stdin); switch (atoi(buf)) { case 1: /* do the 1 stuff */ break; case 2: /* do the 2 stuff */ break; case 3: /* do the 3 stuff */ break; default: printf("INVALID\n"); break; }