Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Pole MAX a MIN
#include <stdio.h> #define N 3 //všude nahraď N číslem 3 #define MAX 3.0 #define MIN -4.0 int main() { double data[N] = {0,}; // inicializace vsech prvku pole na 0 printf("Would you be so kind and insert %d number/numbers please?\n", N); // zadej N = 3 čísla int i = 0; while(i < N) //píšeme ++i a ne i++ { if(scanf("%lf", &data[i]) != 1) { printf("You have inserted incorrect data. The End of program\n"); return 1; } if((data[i] < MIN ) || ( data[i] > MAX)) { printf("Value %lf is out of range.\n", data[i]); //--i; continue; } printf("Zadano spravne cislo %lf\n", data[i]); ++i; } for(int i = 0; i < N; ++i) //vytiskne nam zadana cisla🐱🐉 printf("%lf ", data[i]); putchar('\n'); double min = data[0], max = data[0]; for(int i = 1; i < N; ++i) //zjistuji nejvetsi a nejmensi cislo💕 { if(min > data[i]) min = data[i]; if(max < data[i]) max = data[i]; } printf("Minimum is: %lf\n", min); printf("Maximum is: %lf\n", max); return 0; } // ಠ_ಠ Radši bych teda jezdil na kole. natoč to pak😢
run
|
edit
|
history
|
help
0
inicializace struktury
pointery
bignum test
BPC UDP pr3 cv10 final
Retezce live
arraywithqueue
Square of a Number
Simple c
test1
Eukleides