Write minimum and maximum value | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Write minimum and maximum value

#include<iostream.h> #include<stdlib.h> void main() { randomize(); int marks[]={99,92,94,96,93,95},Mymarks; Mymarks =marks[1+random(2)]; cout<<Mymarks<<endl; }

29th Jun 2019, 4:02 PM
Vineet Joshi
Vineet Joshi - avatar
1 Answer
+ 2
You can define min and max as the first element and check every element in the array and compare with min and max value, or you can sort the array with any method and take first and last elements from it as min and max, depending how you sorted it 👌👌👌
29th Jun 2019, 4:20 PM
Dejan Francuz🥇
Dejan Francuz🥇 - avatar