185k views
25 votes
Write code to display ‘Too loud’ if sound decibel is greater than 40 dB. If sound decibel is less than 40 dB, display ‘Correct Volume’.

User Machaku
by
4.9k points

1 Answer

8 votes

The given code is in c++ .

#include<iostream>

using namespace std;

int main( ){

int s ;

cout<< "Enter sound in decibel "<<endl;

cin>> s;

if( s > 40 ){

cout<< "Too loud "<<endl;

}

else{

cout<< "Correct Volume"<<endl;

}

return 0;

}

//Hence, this is the required solution.

User Anmatika
by
5.6k points