From 5ec5411fd34c2e729cda5ed0c2c6a216c22a30ab Mon Sep 17 00:00:00 2001 From: chazog <chazog@taltech.ee> Date: Sun, 16 Dec 2018 14:10:08 +0200 Subject: [PATCH] Upload New File --- Lab2/LargestValue.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Lab2/LargestValue.c diff --git a/Lab2/LargestValue.c b/Lab2/LargestValue.c new file mode 100644 index 0000000..1ab64bf --- /dev/null +++ b/Lab2/LargestValue.c @@ -0,0 +1,36 @@ +#include <stdio.h> + +int main () { + + int numberArray[10]; + int i; + + i=0; + + while(i<10){ + scanf("%i", &numberArray[i]); + i++; + } + + int maxValue; + maxValue=numberArray[0]; + i=1; + + while (i<10){ + if (numberArray[i]>maxValue) { + maxValue=numberArray[i]; + i++; + }else{ + i++; + } + + } + + printf ("The max value is %i", maxValue); + + + return 0; +} + + + -- libgit2 0.25.0