Answer to Question #253364 in C for enna

Question #253364

Input

1. The first number


Constraints

This may be a decimal number.

2. The second number


Constraints

This may be a decimal number.

3. The third number


Constraints

This may be a decimal number.

4. The fourth number


Constraints

This may be a decimal number.

5. The fifth number


Constraints

This may be a decimal number.


Output

The first line will contain a message prompt to input the first number.

The second line will contain a message prompt to input the second number.

The third line will contain a message prompt to input the third number.

The fourth line will contain a message prompt to input the fourth number.

The fifth line will contain a message prompt to input the fifth number.

The last line contains the sum of all negative numbers rounded off and displayed with 2 decimal places.


1
Expert's answer
2021-10-19T15:20:06-0400
#include <stdio.h>


int main()
{
    float first_num;
    float second_num;
    float third_num;
    float fourth_num;
    float fifth_num;
    
    float arr[5];
    printf("\nEnter first number: ");
    scanf("%f",&first_num);
    arr[0]=first_num;
    printf("\nEnter second number: ");
    scanf("%f",&second_num);
    arr[1]=second_num;
    printf("\nEnter third number: ");
    scanf("%f",&third_num);
    arr[2]=third_num;
    printf("\nEnter fourth number: ");
    scanf("%f",&fourth_num);
    arr[3]=fourth_num;
    printf("\nEnter fifth number: ");
    scanf("%f",&fifth_num);
    arr[4]=fifth_num;
    
    for(int i=0;i<5;i++){
        if(arr[i]<0)
            printf("%.2f\n",arr[i]);
    }


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS