Name this program wind. c - This program prints out a hurricane/tropical storm c
ID: 3883321 • Letter: N
Question
Name this program wind. c - This program prints out a hurricane/tropical storm classification based on its sustained wind speed. The program reads an integer wind speed, representing the sustained wind speed of the hurricane in miles-per-hour (mph). Print out the classification of the system based on this speed. Classification is one of: nothing, tropical depression, tropical storm, category one. category two. category three. Category four, or category five. Print an error message if the user enters a negative wind speed. Hurricane classification information can be found at https: //en.wikipedia.org/wiki/Saffir-Simpson_scale For example, entering a wind speed of 152 should give a classification of Category FourExplanation / Answer
C program:
#include<stdio.h>
main()
{
//delcation of variable
int speed;
printf("Enter a wind speed(mph):");//asking user to enter input
scanf("%d",&speed); //reading user input into speed variable
//classification conditions
if(speed<=38)
{
printf("Tropical depression");
}
else if(speed>=39 && speed<=73)
{
printf("Tropical storm");
}
else if(speed>=74 && speed<=95)
{
printf("Category one");
}
else if(speed>=96 && speed<=110)
{
printf("Category two");
}
else if(speed>=111 && speed<=129)
{
printf("Category three");
}
else if(speed>=130 && speed<=156)
{
printf("Category four");
}
else if(speed>=157)
{
printf("Category five");
}
}
Ouput:
Enter wind speed: 210
Category five
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.