C Programming - Program Mencari Nilai Maximum dan Minimum


#include <stdio.h>

int main()
{
 float min, max, x, y;
 printf("Mencari nilai max dan min dari dua buah bilangan.\n");
 printf("\nInput nilai x\t: ");
 scanf("%f", &amp;x);
 printf("Input nilai y\t: ");
 scanf("%f", &amp;y);

 max = ((x-y)&gt;=0) ? ((x+y)+(x-y))/2.0 : ((x+y)-(x-y))/2.0;
 printf("max\t= %.3f\n", max);

 min = ((x-y)&lt;=0) ? ((x+y)+(x-y))/2.0 : ((x+y)-(x-y))/2.0;
 printf("min\t= %.3f\n", min);

 return 0;
}

Contas Premium
Compartilhe este filme: :

Post a Comment

Related Posts Plugin for WordPress, Blogger...
 
Support : Baixartemplatesnovos.blogspot.com
Copyright © 2012-2014. BATERCUS'S BLOG - todos os direitos reservados para

CINEHD- o melhor site de filmes online