Question

In: Computer Science

Create a small program that contains the following. ask the user to input their name ask...

Create a small program that contains the following.

  • ask the user to input their name
  • ask the user to input three numbers
  • check if their first number is between their second and third numbers

Solutions

Expert Solution

Required code in C -->

#include <stdio.h>
int main(){
int a,b,c; // declare variables for three numbers as datatype int
char name; // declare variable for name as datatype char

printf("Enter your name : ");
scanf("%s",&name); // read name from user
printf("Enter first number\n");
scanf("%d",&a); // read first number from user
printf("Enter second number\n");
scanf("%d",&b); // read second number from user
printf("Enter third number\n");
scanf("%d",&c); // read third number from user

if((a>b && c>a)||(a>c && b>a)){
printf("First number is between second and third number");
}
else{
printf("First number is not in between of second and third number");
}
}

If statement will then evaluate if the first number is between second number and third number, if yes then output will be "First number is between second and third number" else "First number is not in between of second and third number".


Related Solutions

Create a program that keeps track of the following information input by the user: First Name,...
Create a program that keeps track of the following information input by the user: First Name, Last Name, Phone Number, Age Now - let's store this in a multidimensional array that will hold 10 of these contacts. So our multidimensional array will need to be 10 rows and 4 columns. You should be able to add, display and remove contacts in the array. In Java
Create a project that gets input from the user. ( Name the project main.cpp) Ask the...
Create a project that gets input from the user. ( Name the project main.cpp) Ask the user for a value for each side of the triangle. Comment your code throughout. Include your name in the comments. Submit the plan-Psuedo code (include Flowchart, IPO Chart) and the desk check with each submission of your code. Submit the plan as a pdf. Snips of your output is not a plan. Save the plan and desk check as a pdf Name the code...
Question: Conversion Program * This program will ask the user to input meters * After input,...
Question: Conversion Program * This program will ask the user to input meters * After input, a menu will be displayed: * 1. Convert to kilometers * 2. Convert to inches * 3. Convert to feet * 4. Quit * * The user will select the conversion and the converted answer will be displayed. * The program should redisplay the menu for another selection. * Quit program when user selects 4. Hi, my instructor requirement fix the bug in the...
Write a program that will ask for the user to input a filename of a text...
Write a program that will ask for the user to input a filename of a text file that contains an unknown number of integers. And also an output filename to display results. You will read all of the integers from the input file, and store them in an array. (You may need to read all the values in the file once just to get the total count) Using this array you will find the max number, min number, average value,...
Using (C programming language) Create a health monitoring program, that will ask user for their name,...
Using (C programming language) Create a health monitoring program, that will ask user for their name, age, gender, weight, height and other health related questions like blood pressure and etc. Based on the provided information, program will tell user BMI, blood pressure numbers if they fall in healthy range or not and etc. Suggestions can be made as what should be calorie intake per day and the amount of exercise based on user input data. User should be able to...
Task 2.5: Write a script that will ask the user for to input a file name...
Task 2.5: Write a script that will ask the user for to input a file name and then create the file and echo to the screen that the file name inputted had been created 1. Open a new file script creafile.sh using vi editor # vi creafile.sh 2. Type the following lines #!/bin/bash echo ‘enter a file name: ‘ read FILENAME touch $FILENAME echo “$FILENAME has been created” 3. Add the execute permission 4. Run the script #./creafile.sh 5. Enter...
Write a program in C, that uses standard input and output to ask the user to...
Write a program in C, that uses standard input and output to ask the user to enter a sentence of up to 50 characters, the ask the user for a number between 1 & 10. Count the number of characters in the sentence and multiple the number of characters by the input number and print out the answer. Code so far: char sentence[50]; int count = 0; int c; printf("\nEnter a sentence: "); fgets(sentence, 50, stdin); sscanf(sentence, %s;    for(c=0;...
Ask the user to input a series of numbers, write a C# program to output the...
Ask the user to input a series of numbers, write a C# program to output the sum, max, and min. Be sure to do error checking if the user input is not a number.
Python Program Write a program that will ask a user on how many input colored balls...
Python Program Write a program that will ask a user on how many input colored balls of the following codes: R-red, B-blue, W-white, G-green and O-orange -will he or she would like to enter in the program and print the total number of Red balls were encountered. Assume an uppercase and lower case letter will be accepted.
Create a program that ask to input two users and the result will vary on their...
Create a program that ask to input two users and the result will vary on their name with similar digits. In a game of F.L.A.M.E.S , it will count and repeat depends on their name that has a similar digit. For an Example (JOE RIZAL) and (JACKLYN BRACKEN) - JOE RIZAL has - 5 similar digits , while JACKLYN BRACKEN has 6 similar digits so a total of 11. F - Friends - 1,7 L - Lover - 2,8 A...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT