The user input some numbers and i have to count how many times the largest number that he puts appears. I know how to get the largest, but how to count how many times it appear?
im a beginner in programminng.
When I was trying I did this code:
In fact I just need the idea of how do I do that.
im a beginner in programminng.
When I was trying I did this code:
Code:
#include <stdio.h>
#include <stdlib.h>
int main(){
int i,j=0;
float n,s,w;
for(i=1;i<=5;i++){
printf("Primeiro valor: ");
scanf("%f",&n);
if(i==1) s = n;
if(i==1) w = n;
if(n>s){ s=n; j++; printf("%d\n",j); }
if(n<w) { w=n; }
if(n<s && n>w) { }
}
printf("\n%d\n",5-j);
printf("MAX: %f, MIN: %f\n\n",s,w);
system("pause");
}
Comment