Search
 
SCRIPT & CODE EXAMPLE
 

C

c program to find minimum of 4 numbers using conditional operator in c

//C program to find Smallest among four numbers using Conditional or ternary operator

#include<stdio.h>

void main()
{
  // Variable declaration
   int a,b,c,d,small;

   printf("Enter four number
");
   scanf("%d %d %d %d",&a,&b, &c, &d);

 // Smallest among a, b, c and d2
   small = ( (a<b && a<c && a<d) ? a : (b<c && b<d) ? b : (c<d)? c : d );

 //Display Smallest number
   printf("Smallest Number is : %d",small);

}
Comment

c program to find minimum of 5 numbers using conditional operator in c

//C program to find Smallest among five numbers using ternary operator

#include<stdio.h>

void main()
{
  // Variable declaration
   int a,b,c,d,e,small;

   printf("Enter five number
");
   scanf("%d %d %d %d %d",&a,&b, &c, &d, &e);

 // Smallest among a, b, c and d
   small = ( (a<b && a<c && a<d && a<e) ? a : (b<c && b<d && b<e) ? b : (c<d && c<e)? c : (d<e)? d : e );

 //Display Smallest number
   printf("Smallest Number is : %d",small);

}
Comment

PREVIOUS NEXT
Code Example
C :: looping through an array in c 
C :: arduino empty serial buffer 
C :: Happy birthday in C 
C :: input value from terminal to c 
C :: c programming exercises 
C :: c add char to char array 
C :: c read binary file 
C :: array of strings c 
C :: struct in struct 
C :: fifo in c 
C :: functions in c programming 
C :: C Syntax of realloc() 
C :: C Syntax of struct 
C :: insse suprafata arabila pe ani 
C :: Returns numbers between i and 0 
C :: solutionadda 
C :: como somar em C 
C :: User input in struct 
C :: can torch light bring change in chemical reaction 
C :: code wars responsable drinker 
C :: code to reverse the words in a sentnce 
C :: c stack 
C :: 11*179*.9*1.35 
C :: C Why enums are used? 
C :: find a substring within a string in c and return the index 
C :: c refresher 
C :: fread condition 
C :: terrenery opertori with return in c 
C :: transpose of a matrix in c 
C :: strncmp 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =