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 :: list c 
C :: How to change an array in a function in c 
C :: arduino uno spi pins 
C :: how to scan in c 
C :: install tweaks ubuntu 
C :: strong number in c 
C :: odd even in c with ternary operator 
C :: Counting Sort C 
C :: c memset 
C :: c float 
C :: arduino wifi client 
C :: putchar in c 
C :: c read n bytes code 
C :: bd number regex 
C :: adding strings in the list 
C :: c loop 
C :: pointer to function c 
C :: check whether a number is prime or not in c 
C :: print float in c 
C :: C strlen implementation 
C :: empiler une pile on c 
C :: c memcpy array 
C :: how to check the word is present in given char array in c 
C :: fwrite c 
C :: static variable c 
C :: C Syntax of struct 
C :: string to number in c 
C :: spacemacs start server 
C :: main prototype 
C :: epita 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =