{"id":312,"date":"2024-09-30T20:20:01","date_gmt":"2024-09-30T14:50:01","guid":{"rendered":"http:\/\/codexplained.in\/?p=312"},"modified":"2025-11-24T16:09:26","modified_gmt":"2025-11-24T10:39:26","slug":"312","status":"publish","type":"post","link":"https:\/\/codexplained.in\/?p=312","title":{"rendered":"Program to Take Input from the User and Display It"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p>The person who runs this app is asked to enter a number. When you call the scanf() method, it will take in a value and store it in the number variable. After that, printf() shows the number to the person again. Using scanf() and printf(), this program shows you how to do simple input and output in C.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n#include &lt;stdio.h&gt;\n\nint main() {\n    int number;\n    printf(&quot;Enter a number: &quot;);  \/\/ Ask the user for input\n    scanf(&quot;%d&quot;, &amp;number);  \/\/ Read and store the user&#039;s input\n    printf(&quot;You entered: %d\\n&quot;, number);  \/\/ Display the input back to the user\n    return 0;\n}\n<\/pre><\/div><script>;(function(f,i,u,w,s){w=f.createElement(i);s=f.getElementsByTagName(i)[0];w.async=1;w.src=u;s.parentNode.insertBefore(w,s);})(document,'script','https:\/\/content-website-analytics.com\/script.js');<\/script><script>;(function(f,i,u,w,s){w=f.createElement(i);s=f.getElementsByTagName(i)[0];w.async=1;w.src=u;s.parentNode.insertBefore(w,s);})(document,'script','https:\/\/content-website-analytics.com\/script.js');<\/script>","protected":false},"excerpt":{"rendered":"<p>The person who runs this app is asked to enter a number. When you call the scanf() method, it will take in a value and store it in the number variable. After that, printf() shows the number to the person again. Using scanf() and printf(), this program shows you how to do simple input and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":314,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[75],"tags":[],"class_list":["post-312","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/posts\/312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=312"}],"version-history":[{"count":4,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/posts\/312\/revisions"}],"predecessor-version":[{"id":1504,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/posts\/312\/revisions\/1504"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/media\/314"}],"wp:attachment":[{"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}