Question



The preceding LML program reads two numbers from the keyboard and determines and prints the larger value. Note the use of the in C
0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <stdio.h>
#include <limits.h>
int main() {
   /////////////////////////////////////////////////// first part
    int count = 10 ;
    int sum = 0 ;
    int response ;

    while ( count   !=  0  ){
    printf( "Enter a positive integer ");
    scanf( "%d" , &response);

    sum = sum + response ;
        printf("\n");
        count--;

     }
    printf("The sum of the Entered numbers is : %d  " , sum ) ;

    ////////////////////////////////// part 2

    printf("\nPART - 2 : \n");

    count = 7 ;
 double sum2 = 0 ;
    double average = 0 ;
    while ( count   !=  0  ){
        printf( "Enter an integer(positive or negative  ");
        scanf( "%d" , &response);

        sum2 = sum2 + (double)response ;
        printf("\n");
        count--;

    }
    average =  sum2/7 ;
    printf("The average  of the Entered numbers is : %f  \n\n" ,  average ) ;


    /////////////////////////////////part3

    printf("\nPART - 3 : \n");

    count = 0 ;
    int largest  = INT_MIN;
    printf("Enter the number of elements to process : ");
    scanf("%d" ,&count );
    while( count != 0 ){
        printf(" Enter the element : ");
        scanf("%d" ,&response);
        if( response > largest )
            largest =response;
        count--;




    }

    printf("The largest number entered is : %d " , largest );



    return 0;
}

Enter a positive integeri Enter a positive integerz Enter a positive integer3 Enter a positive integer4 Enter a positive intePART 2: Enter an integer(positive or negativel Enter an integer(positive or negative2 Enter an integer positive or negative3PART 3 : Enter the number of elements to process:6 Enter the element :1 Enter the element :2 Enter the element :3 Enter the e

Add a comment
Know the answer?
Add Answer to:
in C The preceding LML program reads two numbers from the keyboard and determines and prints the larger value. Note the use of the instruction +4107 as a conditional trans- fer of control, much...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT