kyduyenhckd226 kyduyenhckd226
  • 26-10-2021
  • Computers and Technology
contestada

Write function maxInput() to return the greatest integer that input from keyboard (scanf inside your maxInput() function) and end when 0 was inputted.

Respuesta :

nhozbiniunho nhozbiniunho
  • 31-10-2021

Answer:

#include <stdio.h>

int maxInput(){

   int max;

   int n, i;

   max=-100;

   n=-10;

   i=0;

   while(1){

       scanf("%d",&n);

       if(max<=n && n!=0){

           max =n;

       }

       if (n==0){

           break;

       }

       i++;

   }

   if (i!=0){

   return max;

   }

   else{

       return 0;

   }

}

Explanation:

Answer Link

Otras preguntas

Find the acceleration of a hamster when it increases its velocity from rest to 8.0 m/s in 3.0 s .
How do biologists study life? apply the principles of scientific inquiry to evaluate hypotheses, experiment design, and conclusions of an investigation?
Find the product of 21 and (6.3x10^-4)
draw four points, A, B, C, D, on a line so that AC and AB are opposite rays and AC and AD are the same ray
I need a quick good conclusion thank you
What happens as a result of humans settling down into agriculture villages
A compunds whose empirical formula is xf3 consists of 65% f by mass. what is the atomic mass of x
Factor completely 16a^3b^7 + 2a^6 b4 − 22a ^4 b^5. 2(8a3b7 + a6b4 − 11a4b5) 2a3b4(8b3 + a3 − 11ab) a3b4(16b3 + 2a3 − 22ab) 8b3 + a3 − 11ab
What is P = 2a + 2b for a
What part of speech does the capitalized word have? The TAUNTS are rude and need to stop!" cried Mrs. Norris.