How to find out smallest number among 3 numbers without conditional statement - My articles - Publisher - Information Technology
Sunday, 2016-12-04, 5:16 PM
ebooks Programming Computer Science
Welcome Guest | RSS
Site menu
Section categories
My articles [23]
Main » Articles » My articles

How to find out smallest number among 3 numbers without conditional statement
#include<stdio.h>

 int smallest(int a,int b,int c)
{
     int p=0;
     
     while(a && b && c)
     {
        a--;b--;c--;p++;    
     }
     return p;
}

void main()
{
     int a=3,b=5,c=9;

     printf("The smallest number among 3 numbers is %d\n",smallest(a,b,c));
}
Category: My articles | Added by: Sumrat (2012-11-30)
Views: 1250 | Rating: 0.0/0
Total comments: 0
Name *:
Email *:
Code *:
Our poll
Rate my site
Total of answers: 152
Statistics

Total online: 1
Guests: 1
Users: 0
Login form