Answer to Question #313138 in C for Suhani Goel

Question #313138

The national earthquake information center characterizes the effect of

earthquakes based on Richter scale numbers. Write a C program to implement

the following decision table

.

Ritcher scale number (n)

Characterization

n<5.0

Little or no damage

5.0 <= n < 5.5

Some damage

5.5 <= n < 6.5

Serious damage: Walls may crack or fall

6.5 <= n < 7.5

Disaster: houses and buildings may collapse

Higher

Catastrophic: most

buildings destroyed



1
Expert's answer
2022-03-17T06:42:36-0400
#include <stdio.h>

int main()
{
    float n;

    printf("Enter Ritcher scale number (n): ");
    scanf("%f", &n);
    printf("\nCharacterization:\n");
    if (n < 5.0)
        printf("Little or no damage\n");
    else if ((5.0 <= n) & (n < 5.5))
        printf("Some damage\n");
    else if ((5.5 <= n) & (n < 6.5))
        printf("Serious damage: Walls may crack or fall\n");
    else if ((6.5 <= n) & (n < 7.5))
        printf("Disaster: houses and buildings may collapse\n");
    else
        printf("Catastrophic: most buildings destroyed\n");    
    getchar();
}

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