Write a program that ask for user input from 5 to 9 then calculate the average

1 Answer

Answer :

#include "iostream.h"
int main() {
int MAX = 4;
int total = 0;
int average;
int numb;
for (int i=0; i<MAX; i++) {
cout << "Please enter your input between 5 and 9: ";
cin >> numb;
while ( numb<5 || numb>9) {
cout << "Invalid input, please re-enter: ";
cin >> numb;
}
total = total + numb;
}
average = total/MAX;
cout << "The average number is: " << average << "\n";
return 0;
}

Related questions

Description : Write a program to accept marks of four subjects as input from user. Calculate and display total and percentage marks of student. 

Last Answer : #include<stdio.h> #include<conio.h> void main() { float marks[4]; float total=0.0, perc=0.0; int i; clrscr(); for(i=1;i<=4;i++) { printf("Enter marks of ... is :%f",total); perc=total/4; printf("Percentage is %f",perc); getch(); }

Description : How Write javascript program to display multiplication table of 2 without accepting input from user?

Last Answer : Use a counted for loop. On each iteration, multiply the controlvariable by 2 and print the result.

Description : Write a program to accept a string as input from user and determine its length. [Don’t use built in library function strlen()]

Last Answer : #include #include void main(){ char str[50]; int i, len=0; clrscr(); printf("Enter a string"); scanf("%s",&str); for(i=0; str[i]!='\0'; i++){ len++; } printf("The length of string is %d",len); getch(); }

Description : Write a program to input name and salary of employee and throw user defined exception if entered salary is negative. 

Last Answer : import java.io.*; class NegativeSalaryException extends Exception { public NegativeSalaryException (String str) { super(str); } } public class S1 { public static void main(String[] args) ...  catch (NegativeSalaryException a) {  System.out.println(a);  } } }

Description : Write a shell script to accept length and breadth of rectangle from user. Calculate and display area, perimeter, of entered values using choice entered by user.

Last Answer : #!/bin/bash # GNU bash, version 4.3.46 echo "Enter Length of Rectangle: " read length echo "Enter Breadth of Rectangle: " read breadth echo "Which operation you want to perform? 1: area 2: perimeter" read ... ) res=` echo 2 \* $length \* $breadth | bc` ;; esac echo "Result is $res" exit 0

Description : We use the output of the requirement analysis, the requirement specification as the input for writing :- a) User Acceptance Test Cases b) Integration Level Test Cases c) Unit Level Test Cases d) Program specifications

Last Answer : a) User Acceptance Test Cases

Description : In Unix operating system, special files are used to : (A) buffer data received in its input from where a process reads (B) provide a mechanism to map physical device to file names (C ... pointers associated with i-nodes (D) store information entered by a user application program or utility program

Last Answer : (B) provide a mechanism to map physical device to file names 

Description : Which converts the user data into machine readable form? A) input unit, output unit, control unit B) central processing unit C) output unit D) decoder unit

Last Answer : Answer : A

Description : Which one of the following input device is user- programmable? A) Dumb terminal B) Smart terminal C) VDT D) Intelligent terminal

Last Answer : Answer : D

Description : Which unit converts user data into machine readable form? A) Input unit B) Output unit C) ALU D) Control Unit

Last Answer : Answer : A

Description : Which of the following is not a function of the Input Unit? a) It reads instructions and data from the outside world. b) It converts the data into computer acceptable format. c) It ... into user understandable format. d) It supplies the data and instructions to the computer for further processing.

Last Answer : Answer: c Explanation: The input unit converts the data into computer understandable format i.e. binary format and not the user understandable format. It is the duty of the output unit to make the data into user understandable format

Description : Which unit is responsible for converting the data received from the user into computer understandable format? a) Memory Unit b) Arithmetic & Logic Unit c) Input Unit d) Output Unit

Last Answer : Answer: c Explanation: The Input Unit converts the data, which the user enters into a language which the computer understands, i.e. it converts the data into binary format. The ... after immediate results of processing whereas; the ALU is responsible for various arithmetic and bitwise operations

Description : ________ is an input device that accepts input when the user places a fingertip on the computer screen. A. Joy Stick B. Light Pen C. Trackball D. Touch Screen

Last Answer : D. Touch Screen

Description : Which among the following is correct characteristics about proxy server: a) A proxy server may act as a firewall by responding to input packets in the manner of an application while blocking other packets. b) A ... as a proxy on behalf of the network user; d) All of the Above e) None of These

Last Answer : d) All of the Above

Description : What is used in most programs that are part of a program and guide the user to specific steps ?

Last Answer : Most programs use a wizard that is part of a program and guides the user through specific steps.

Description : What is System Analysis? A) The design of the screen the user will see and use to enter or display data B) System analysis defines the format and type of data the program will use C) System Analysis involves creating formal model of the problem to be solved D) None of the above

Last Answer : Answer : C

Description : An application program that helps the user to change any number and immediately see the result of that change is A) Desktop publishing program B) Database C) Spreadsheet D) All of above

Last Answer : Answer : C

Description : Which statement is valid about computer program? A) It is understood by a computer B) It is understood by programmer C) It is understood user D) Both a & b

Last Answer : Answer : D

Description : The _____ manual tells you how to use a software program: a) User b) Programming c) Documentation d) Technical e) None of These

Last Answer : a) User

Description : The..... manual tells you how to use a software program. 1) Documentation 2) Programming 3) Technical 4) User

Last Answer : 1) Documentation

Description : Allocation of a resources in a time dependent fashion to several program simultaneously called 1) multi tasking 2) multi user 3) time sharing 4) None

Last Answer : 3) time sharing

Description : Allocation of a resources in a time dependent fashion to several program simultaneously called 1 multi tasking 2 multi user 3 time sharing 4 None

Last Answer : 3 time sharing

Description : What is the full form of UDP a. Union Development Program b. User Data Program c. User Datagram Protocol d. Unified Datagram Provider

Last Answer : c. User Datagram Protocol

Description : What is the full form of UDP a. Union Development Program b. User Data Program c. User Datagram Protocol d. Unified Datagram Provider

Last Answer : c. User Datagram Protocol

Description : A computer checks the _____ of user names and passwords for 9 a match before granting access. 1) Website 2) Network 3) Backup file 4) Data base 5) None of these

Last Answer : Answer :4

Description : In C Programming Language Can someone write a program that will interact with the user by name and allow for the recording of grades for three classes Tech History and Math?

Last Answer : More info;You will write a program that will interact with the user by name and allow for the recording of grades for three classes: Tech, History, and Math. The program will allow the user ... current grade in each classTell the user their current gpa based on the overall percentage of each class

Description : Write a program to add, subtract, multiply and divide two numbers, accepted from user switch case.

Last Answer : #include<stdio.h> #include<conio.h> void main() { int a,b,ch,add,sub,mul,div; clrscr(); printf("\n1 for addition \n2 for substraction"); printf("\n3 for multiplication \ ... break; default: printf("Invalid choice...."); } getch(); }

Description : Write a program to accept two numbers from user and perform addition, subtraction, multiplication and division operations using pointer.

Last Answer : #include #include void main() { int no1,no2,*ptr1,*ptr2,result; clrscr(); printf("Enter no1:"); scanf("%d",&no1); printf("\nEnter no2:"); scanf("%d",&no2); ptr1=&no1; ptr2=&no2; ... "\n Multiplication=%d",result); result=*ptr1/(*ptr2); printf("\n Division=%d",result); getch(); }

Description : Draw a flowchart of Do-while loop and write a program to add numbers until user enters zero. 

Last Answer : Flowchart of Do-while loop: Program:- #include<stdio.h> #include<conio.h> void main() { int no,sum=0; clrscr(); do { printf("\n Enter a number:"); scanf( ... no; }while(no!=0); printf("\n Sum of entered numbers =%d",sum); getch(); }

Description : Write a program in C++ to accept a string from a user and display its reverse using pointer.

Last Answer : #include<iostream.h> #include<conio.h> #include<string.h> void main() { char str[20],*ptr; int l; clrscr(); cout<<"\n Enter a string : "; cin>>str; l=strlen(str); ... (l!=0) { ptr--; cout<<*ptr; l--; } getch(); }

Description : What do you call the translator which takes assembly language program as input & produce machine language code as output? A) Compiler B) Interpreter C) Debugger D) Assembler

Last Answer : Answer : D

Description : ____________ is the raw material used as input and __________ is the processed data obtained as output of data processing. a) Data, Instructions b) Instructions, Program c) Data, Program d) Program, Code

Last Answer : Answer: a Explanation: Data can be assumed as a raw material which , in turns after processing gives the desired output in the form of instructions. Further, a set of ordered and meaningful instructions is known as a program

Description : A memory in CPU that holds program instructions, input data, intermediate results and the output information produced during processing is __________ A. System B. Primary Memory C. Secondary Memory D. None of the above

Last Answer : B. Primary Memory

Description : The time between program input and output is called (1) Turn around time (2) Waiting time (3) Execution time (4) Delay time

Last Answer : Turn around time

Description : For consumers, _______ is helpful as it allows you to calculate the actual money you would spend in electricity bills for that particular product. a. Electricity bill c. BEE Star Rating b. User manual d. Water bill

Last Answer : BEE Star Rating

Description : 2. write a Python program to calculate the area of a circle. -Artificial Intelligence

Last Answer : # Python Program to find Area Of Circle using Radius PI = 3.14 radius = float(input(' Please Enter the radius of a circle: ')) area = PI * radius * radius circumference = 2 * PI * radius print(" Area Of a Circle = area + "sq ms") print(" Circumference Of a Circle = circumference +"cms")

Description : How to write a Python program (i)to calculate area of a circle and (ii)to find if a given number is even or odd. -Python

Last Answer : (i) # 1.Circle pi = 3.14 r = int(input("Please enter the Radius of the circle:")) area = pi*r*r print("Area of the circle is" + str(area) + "sq ms") (ii) # 2. Odd Number & Even Number Number = int( ... Number % 2 == 0): print("This is an Even Number") else: print("It's an Odd Number")

Description : Write a C++ program to declare a class addition with data members as x and y. Initialize values of x and y with constructor. Calculate addition and display it using function ‘display’.

Last Answer : #include<iostream.h> #include<conio.h> class addition { int x,y; public: addition(int,int); void display(); }; addition::addition (int x1,int y1) { x=x1; y=y1; } void addition: ... y); } void main() { addition a(3,4); a.display(); getch(); }

Description : Write a C++ program to declare a class ‘circle’ with data members as radius and area. Declare a function getdata to accept radius and putdata to calculate and display area of circle.

Last Answer : #include<iostream.h> #include<conio.h> class circle { float radius,area; public: void getdata() { cout<<"Enter radius:"; cin>>radius; } void putdata() { area=3 ... { circle c; clrscr(); c.getdata(); c.putdata(); getch(); }

Description : Write a program to calculate sum of all the odd numbers between 1 to 20.

Last Answer : Write a program to calculate sum of all odd element of 1D array

Description : If the value of a number (N) is entered through keyboard. Write a program using recursion to calculate and display factorial of number (N). 

Last Answer : #include<stdio.h> #include<conio.h> int factorial(int N); void main() { int N,fact; clrscr(); printf("Enter number:"); scanf("%d",&N); fact=factorial(N); printf( ... N) { if(N==1) return(1); else return(N*factorial(N-1)); }

Description : Write a program to calculate area of circle and area of rectangle using function overloading. 

Last Answer : #include<iostream.h> #include<conio.h> float area(float a) { return (3.14*a*a); } int area(int p,int q) { return(p*q); } void main() { clrscr(); cout< ... ;<<area(6); cout<<"Area of Rectangle:"<<area(5,6); getch(); }

Description : Write a program in C++ to overload a „volume‟ function to calculate volume of cube and rectangular box. 

Last Answer : #include<iostream.h> #include<conio.h> void volume(float); void volume(float, float, float); void main() { float a, length, width, height; clrscr(); cout<<"\n ... width*height; cout<<"\n Volume of a rectangular box is:"<<v; }

Description : If a program in its functioning has not met user requirements is some way, then it is (A) an error. (B) a failure. (C) a fault. (D) a defect.

Last Answer : (D) a defect.

Description : Why would taskbar buttons be randomly flashing without user input?

Last Answer : Specifically what taskbar buttons are these? They may be running something, so when it is finished they flash.

Description : An LCD monitor allows the user to input information, by touching the icons on the screen. -Technology

Last Answer : FalseBecause most of the LCD monitors do not come with touch facility where information is provided by touching the icons.

Description : The ……….. is code that recognizes some special sequence of input or is triggered by being run from a certain user ID of by unlikely sequence of events. a) Trap doors b) Trojan horse c) Logic Bomb d) Virus

Last Answer : a) Trap doors

Description : Report generatorsare usedto A. store data input bya user B. retrieve information from files C. answer queries D. both (b)and (c) E. None of the above

Last Answer : both (b)and (c)

Description : The process of the JobTracker creates one map task for each computed input split by the user node and assigns the map tasks to the execution slots of the TaskTrackers is called as a) Task Execution b) Task Running Check c) Job Submission d) Task Assignment

Last Answer : Task Assignment

Description : Which one of the following input device is user-programmable? a. Dumb terminal b. Smart terminal c. VDT d. Intelligent terminal

Last Answer : d. Intelligent terminal