{"id":158,"date":"2021-09-30T07:06:37","date_gmt":"2021-09-30T07:06:37","guid":{"rendered":"https:\/\/ethosspace.com\/programmers\/?p=158"},"modified":"2021-10-11T11:48:39","modified_gmt":"2021-10-11T11:48:39","slug":"c-program-for-smallest-of-three-numbers-without-comparing","status":"publish","type":"post","link":"https:\/\/ethosspace.com\/programmers\/c-program-for-smallest-of-three-numbers-without-comparing\/","title":{"rendered":"C Program for Smallest of three numbers without comparing"},"content":{"rendered":"\n<p>There are many ways to find smallest. Below program will accept 3 integer numbers from user<\/p>\n\n\n\n<p>We are using while loop here and one increment variable.<\/p>\n\n\n\n<p>Every time program is subtracting value by 1 and incrementing counter variable by 1. once condition is false program will return smallest number. This is simple basic mathematical operation. Below is complete running code.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Program Name: C Program to find smallest number without comparison\n#include &lt;stdio.h&gt;\n\nvoid main()\n{\n    int num1,num2,num3;\n    int counter=0;\n    printf(\"\\n\\tEnter first Integer Number\\t\");\n    scanf(\"%d\",&amp;num1);\n    printf(\"\\n\\tEnter Second Integer Number\\t\");\n    scanf(\"%d\",&amp;num2);\n    printf(\"\\n\\tEnter Third Integer Number\\t\");\n    scanf(\"%d\",&amp;num3);\n    \n    \n    \/\/ Here we are using while loop when result is false we will get smallest number \n    while(num1 &amp;&amp; num2 &amp;&amp; num3)\n    {\n        num1--;\n        num2--;\n        num3--;\n        counter++;\n    }\n    printf(\"\\n\\t Minimum of 3 Number is %d\", counter);\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Enter first Integer Number      4\n\n        Enter Second Integer Number     3\n\n        Enter Third Integer Number      0\n\n         Minimum of 3 Number is 0<\/code><\/pre>\n\n\n","protected":false},"excerpt":{"rendered":"<p>There are many ways to find smallest. Below program will accept 3 integer numbers from user We are using while loop here and one increment variable. Every time program is subtracting value by 1 and incrementing counter variable by 1. once condition is false program will return smallest number. This is simple basic mathematical operation. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[6],"tags":[],"class_list":["post-158","post","type-post","status-publish","format-standard","hentry","category-c-language"],"aioseo_notices":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"sparkling-featured":false,"sparkling-featured-fullwidth":false,"tab-small":false},"uagb_author_info":{"display_name":"program45_-rt8nb","author_link":"https:\/\/ethosspace.com\/programmers\/author\/program45_-rt8nb\/"},"uagb_comment_info":0,"uagb_excerpt":"There are many ways to find smallest. Below program will accept 3 integer numbers from user We are using while loop here and one increment variable. Every time program is subtracting value by 1 and incrementing counter variable by 1. once condition is false program will return smallest number. This is simple basic mathematical operation.&hellip;","_links":{"self":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/comments?post=158"}],"version-history":[{"count":4,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/158\/revisions"}],"predecessor-version":[{"id":271,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/158\/revisions\/271"}],"wp:attachment":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/media?parent=158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/categories?post=158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/tags?post=158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}