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

Q1 Create a program that asks the user to input their budget. Then, it will ask...
Q1 Create a program that asks the user to input their budget. Then, it will ask the user to input each of their purchase until their entire budget is used up. What kind of loop do you think is the most appropriate? You don't have to create the entire program. Part of it has already been created for you (see code below). Note: Assume that the user always uses up their budget to the last cent and they don't over...
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...
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
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...
Create a program (Python) YourFirstnameLastnameA06b.py to ask the user to create a password: The user will...
Create a program (Python) YourFirstnameLastnameA06b.py to ask the user to create a password: The user will first enter a password, then enters the same password again; If the second input is the same as first one, the user successfully creates the password. Print “Well done.”; Otherwise, the user will be directed to repeat the whole process (go to step 1.)
2. Write a program to do the following: • ask the user to input the size...
2. Write a program to do the following: • ask the user to input the size of an array of integers and allocate space for the array • ask the user to input the integer values for the array and store these values into the array • calculate and display the sum and the average of elements of the array
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...
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,...
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...
Create a program that allows a user to input customer records (ID number, first name, last...
Create a program that allows a user to input customer records (ID number, first name, last name, and balance owed) and save each record to a file. When you run the main program, be sure to enter multiple records. Once you create the file, open it and display the results to the user Save the file as  CustomerList.java
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT