Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write the code in C 1. Write a program that asks the user to enter an international dialing code and then looks it up
Please write the code in C
1. Write a program that asks the user to enter an international dialing code and then looks it up in the country_codes array.If it finds the code, the program should display the name of the corresponding country; if not, the program should print an error message. Enter dialing code: : 54 The country with dialing code 54 is Argentina. Enter dialing code : 100. No corresponding country found. const struct dialing_code country_codes[] = {{"Argentina", 54}, {"Bangladesh", 880), {"Brazil", 55}, {"Burma (Myanmar)", 95), {"China", 86}, {"Colombia", 57}, {"Congo, Dem. Rep. of", 243}, {"Egypt", 20}, {"Ethiopia", 251}, {"France", 33}, {"Germany", 49}, {"India", 91}, {"Indonesia", 62}, {"Iran", 98}, {"Italy", 39}, {"Japan", 81}, {"Mexico", 52}, {"Nigeria", 234}, {"Pakistan", 92}, {"Philippines", 63}, {"Poland", 48}, {"Russia", 7}, {"South Africa", 27}, {"South Korea", 82}, {"Spain", 34}, {"Sudan", 249}, {"Thailand", 66}, {"Turkey", 90}, {"Ukraine", 380}, {"United Kingdom", 44}, {"United States", 1}, {"Vietnam", 84}}; Enter dialing code: 54 The country with dialing code 54 is Argentina Process exited after 1.475 seconds with return value 0 Enter dialing code: 100 No corresponding country found Process exited after 1.313 seconds with return value 0Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started