How to write a C Program to Gets loudness level from user; chooses a response And prints it using logical and operative statements in C Programming Language ?
Solution:
/* Gets loudness level from user; choses a response * And prints it using logical and operative statements. */ #include <stdio.h> int main(){ /* It's an int because it worked out weird with decimals */ int Loudness, GoAgain; BEGINAGAIN: printf("How loud (in decibel levels) are you? No decimals please.\n"); scanf("%d", &Loudness); /* Determines the response: */ if (Loudness <= 50) /* reverts to this if more than 21 digits are entered */ printf("Speak up!! You're too quiet\n\n"); else if (Loudness > 50 && Loudness <= 70) /* 51-70 */ printf("That's better, now I can hear you\n\n"); else if (Loudness > 70 && Loudness <= 90) /* 71-90 */ printf("Too loud, you are getting annoying\n\n"); else if (Loudness > 90 && Loudness <= 110) /* 91-110 */ printf("Quiet, you ARE annoying!\n\n"); else if (Loudness > 110) /* Note - reverts to what I can only assumed to be 0 when over 21 digits */ printf("Ahhhh, now you sound like Mr. Adamakos!!!\n\n"); /* Should never be displayed */ else printf("Error\n\n"); /* Debugging tool: Lets the code repeat over and over again. * Commented out because it causes weird reactions with decimals */ /* printf("Go again? y = 1, n = 0\n"); scanf("%d", &GoAgain); if(GoAgain == 1) { printf("\n\n"); goto BEGINAGAIN; } */ return 0; }
Learn More :
Enter by User
- C Program to Enter an ODD number between 1 and 49.
- C Program to Calculation of One Number Raised to Another
- C Program to Count Vowels, Consonants and Spaces in a string
- C Program to calculate Area, Perimeter of Rectangle; Area, Circumference of Circle.
- C program calculates a given function in range given by user, stores the data in arrays and displays the answer in a table.
- C Program to find result where value and power are user given
- C Program That in a Given Natural Number x Insert Figure c at Position p
- C Program To Find Prime Number And If Number Is Not Prime Then Find Factors
- C program that lets the user choose if he wants to add a item to the shopping list or print it out
- C Program that prompts the user to input a string, (whitespaces allowed)
- C Program to Input Number by the user between 1-100
- How to Gets User Input For Height in C Programming
- C Program Exchange User Entered Text Between 2 Modules
- C Program to accept n numbers from user & find out the maximum element out of them by using dynamic memory allocation
- C Program to accept string from user & convert all lower case letters into upper case letters & vice versa
- C Program to accept m*n matrix from user and display the elements of given matrix using function
- C Program to accept n numbers from user store these numbers into an array & calculate average of n numbers
- C program to accept n number from user,store these numbers into an array & count the no of occurrences of each number
- C Program to accept n numbers from user store these numbers into an array & reverse an array elements using function
- C Program to accept a string from user, delete all vowels from that string & display the result
- Write a c program to accept a string from user & generate following pattern (e.g, input "abcd")
- C Program to accept 5 names from user & store these names into an array. Sort these array elements in alphabetical order
- C Program to accept n numbers from user,store these numbers into an array & sort the number of an array
- C Program to accept n numbers from user, store these numbers into an array. Find out Maximum & Minimum number from an Array
print
- PRINT PRIME NUMBERS BETWEEN 1-300 USING BREAK AND CONTINUE IN C
- Write a c program to print Pascal triangle.
- C or C++ Program To Print Prime Number
- C Program print fill zero & mod/div
- C Program to printf & scanf Example
- C Program to Print a String Without Use Semicolon.
- C Program To Input & Print More Than One Words In Single Line
- C Program To Print Alphabets Like {Aa Bb Cc...}
- C Program To Print Alphabets Like {Az By Cx...}
- C Program To Print Lines Of A Paragraph Having More Than 15 Characters
- C Program To Print Prime Numbers Upto The Number You Want
- C Program To Print String In Formatted Output Form
- C Program To Print Sum Of n Digit Number
- C Program To Print Table Horizontally
- C Program To Print Tridiagonal Matrix
- C Program To Print Text Into Uppercase
- Printing ASCII Table with Numbers and corresponding characters
- C Program to print all prime numbers from 1 to 300.
- C program that lets the user choose if he wants to add a item to the shopping list or print it out
- C Program to print table vertically
- C program that receives 10 float numbers from the console and sort them in non-ascending order, and prints the result
- Function should print the cartesian coordinates of the struct argument
- C Program Read a char & print next char ( file to file )
- Primul meu program in C Program
Statement
Loudness
Chooses
Operative
Response
Logical