Thread: help

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    15

    help

    can some one help me i have this code but i need to find the max and min number i dont know how.
    Code:
    /* LAB 2
     * Cery */
    
    
    #include <stdio.h>
    
    int main(void)
    {
        float  seq, sum = 0, mean;
    	int  status, num = 0;
    	
    	printf("Enter number \n");
    	scanf("%f", &seq);
    
        while (status)
    	{
    		num++;
    		sum = sum + seq;
    		printf("Enter number(press q to finnish) \n");
    		status = scanf("%f", &seq);
    		mean = sum / num;
    	}
    
    	printf("The number you entered are: %d times\n",num);
    	printf("The sum is: %f\n", sum);
    	printf("The Max of the number: %d\n",seq);
    	printf("the mean value is: %f\n", mean);
    		
    return 0;
    }
    Last edited by juiceceri; 11-21-2009 at 12:24 PM. Reason: new problem

Popular pages Recent additions subscribe to a feed