Here's a C program to convert the given number (1 to 10) to characters with output and proper explanation. This program makes use of C's Switch Case and Break statements.
# include <stdio.h> # include <conio.h> void main() { int n ; clrscr() ; printf("Enter a number <1 to 10> : ") ; scanf("%d", &n) ; switch(n) { case 1 : printf("\nONE") ; break ; case 2 : printf("\nTWO") ; break ; case 3 : printf("\nTHREE") ; break ; case 4 : printf("\nFOUR") ; break ; case 5 : printf("\nFIVE") ; break ; case 6 : printf("\nSIX") ; break ; case 7 : printf("\nSEVEN") ; break ; case 8 : printf("\nEIGHT") ; break ; case 9 : printf("\nNINE") ; break ; case 10 : printf("\nTEN") ; break ; default : printf("\nInvalid Input.") ; } getch() ; }
Output of above program is
Enter a number <1 to 10> : 1
ONE
Explanation of above program
The program first asks user to enter a number between 1 to 10. When user enters a number the program take that
value and passes it to the switch-case statement. Here the program picks
a case based on the value that user entered before and executes that
particular case. If no case matches the users request, default case will
be executed.
Suggestion: If you notice you'll see that inside each case there is a break statement. Now what is the need to use break statement inside each case? Read it here - Why use break statement inside switch case.
Suppose user entered 1this value is passed to the switch case statement and the case that matches the value that's passed is executed. In this case, CASE 1 will be executed printing the text "ONE" and then execution of switch case is stopped using a break statement.
When user enters a value that doesn't match any case then the default case is executed.
Casino 2021: How to Make a Deposit, Claim Your Free Bonus
Casino 서울특별 출장샵 2021 성남 출장샵 has arrived! Here are the steps you 광주 출장샵 need to follow: 부산광역 출장마사지 Click here to deposit in and receive 강원도 출장마사지 a 100% up to $1000 bonus.
CNC precision machining can produce numerous kinds of complicated parts and Bluetooth Gaming Headset elements with a excessive degree of accuracy. Machines and instruments could be} managed via CNC machining embody lathes, grinders, routers and mills. CNC machines are managed by expert machinists and machine operators who program device paths primarily based on the geometry of the finished machined parts. A CAD software program (computer-aided design) mannequin supplies the part geometry info. The automated nature of CNC machining permits the manufacturing of excessive precision and excessive accuracy, simple parts and cost-effectiveness when fulfilling one-off and medium-volume manufacturing runs.