# Lesson 03: Basic I/O Function

Input and output are the basic elements of the program. The computer needs to input the data, processing the data, then output the results. The basic input and output are keyboard and screen: read data from the keyboard, and print the results on the screen. This lesson describes the basic input and output functions in C and C++. Lesson 16 will introduce input and output functions for file access.

## Questions

1. Write a program that does the following:
• Creates two variables, num and denom, that represent the numerator (top) and denominator (bottom) of a fraction.
• Aska the user to supply values for the numerator and denominator.
• Puts the values supplied into the variables
• Displays the fraction in the format 2/3, with a slash between the two numbers.

Some sample interaction with this program might look like below:

Enter the numerator: 4
Enter the denominator: 7
Fraction = 4/7

2. Let me think about it ...
{"ft_lang_label":"__label__en","ft_lang_prob":0.76817,"math_prob":0.9492668,"size":31748,"snap":"2022-05-2022-21","text_gpt3_token_len":8272,"char_repetition_ratio":0.1329385,"word_repetition_ratio":0.08938235,"special_character_ratio":0.27863172,"punctuation_ratio":0.13868494,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9892941,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-05-16T22:23:48Z\",\"WARC-Record-ID\":\"<urn:uuid:a08a07d2-fa9d-46c2-9b6f-ee5d0c065f3d>\",\"Content-Length\":\"162900\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:81d24bb9-204e-483b-a703-4add65fb5447>\",\"WARC-Concurrent-To\":\"<urn:uuid:0c856bb0-22a4-40f5-ac5e-f2b420e0284d>\",\"WARC-IP-Address\":\"23.92.27.183\",\"WARC-Target-URI\":\"http://www.airsupplylab.com/embedded-c-c/36-c-lesson-03-basic-i-o-function.html\",\"WARC-Payload-Digest\":\"sha1:5MORQ4ETXQKOIAVYWFWXB6GACEDP7V4Y\",\"WARC-Block-Digest\":\"sha1:XUGVB26NJTP6O542EXUZO5XJZ3QYZW4A\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-21/CC-MAIN-2022-21_segments_1652662512249.16_warc_CC-MAIN-20220516204516-20220516234516-00080.warc.gz\"}"}