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. Below is complete running code.
// Program Name: C Program to find smallest number without comparison
#include <stdio.h>
void main()
{
int num1,num2,num3;
int counter=0;
printf("\n\tEnter first Integer Number\t");
scanf("%d",&num1);
printf("\n\tEnter Second Integer Number\t");
scanf("%d",&num2);
printf("\n\tEnter Third Integer Number\t");
scanf("%d",&num3);
// Here we are using while loop when result is false we will get smallest number
while(num1 && num2 && num3)
{
num1--;
num2--;
num3--;
counter++;
}
printf("\n\t Minimum of 3 Number is %d", counter);
}
Output
Enter first Integer Number 4
Enter Second Integer Number 3
Enter Third Integer Number 0
Minimum of 3 Number is 0