1. Write a program to read 2 numbers. Display the greatest of all.
Q: Question 2 Write a program which takes two float numbers from the user and check, if first number is…
A: algorithm:- (I) input first, second (II) if(first>second) { first=first+5;…
Q: Q4. Write a program to read a number and calculate if it is prime or not?
A: #include <iostream>using namespace std; int main() { int i, n; bool isPrime = true;…
Q: Q1) Write a complete program to convert Decimal number to Binary number by using suitable data…
A: 1)Code: As you have not mentioned the coding language i am providing the code in C language: Note:…
Q: 2. Write a program which takes names of five countries as input and prints them in alphabetical…
A: c program which takes string as a country name takes 5 string and then output countries name in…
Q: 7. Write the following program and display the result number = int(input("Enter an integer: ")) d1 =…
A: input() function take the input from the user.
Q: 07: Write a program to read 3 numbers, and write the largest and smallest numbers. 08: Write C++…
A: #include <iostream> #include <conio.h> using namespace std; int main() {…
Q: (B)The following is a list of 20 exam scores. Write a computer program to calculates the average…
A: Python Program:- n=int(input("Enter the number of elements to be inserted: "))a=[]for i in…
Q: 7. Write a program that keeps reading values from the user until the user enters a negative value,…
A: The Answer is in given below steps The code is in c language
Q: 5. Write a program to display the result, as int and float, half, the sum of 10.5 and 21
A: float half sum is directly calculated. int half sum is not directly calculated use the type…
Q: Exercise 2. Write a program that inputs three integer numbers from the keyboard and prints the sum,…
A: Step-1: Start Step-2: Declare and Input three float variables a,b,c Step-3: Calculate their sum…
Q: 4)Write program that input the user age and print the sentence: a) You are child if the age is less…
A: There is not mentioned any programming language so I used JAVA Step 1 : Declare a variable age and…
Q: 1. Write program to generate random numbers in different ranges and display the number: (a) a number…
A: Java program to find random value in different range
Q: 1- Write a program to read a sequence of number (n), then print the times repeat of a specific…
A: Required: A program to find how many times a number is repeated in a sequence. Required code with…
Q: 3- Write a program to print the days of the week when we enter its number
A: Module VBModule Sub Main()dim n as integer = System.console.readline() select case n case 1…
Q: 10. Write a program that computes the sum: 7 k! R = -2 + k
A: code :- import mathvalue = 0.0 def factorialofvalue(n): return 1 if (n==1 or n==0) else n *…
Q: Q2:::write a program that computes ,prints and plots A=√X, B-log X; C-In X; D=cx; E-3X; F=X7 Where X…
A: x=1:20 A=sqrt(x) plot(x,A)
Q: 1. Write a program that reads in two integers and determines and prints if the first is a factorial…
A: Please find the answer below
Q: Q4. Write a program to read a 10 number and calculate if it is prime or not?
A: As there is no programming language mentioned so i attempted this program in c++ In program user…
Q: Question 2 Write a program which takes two float numbers from the user and check, if first number is…
A:
Q: 3. Write a program that displays the following pattern: ***** *** * *** *****
A: As no programming language is mentioned, it is solved using basic C++
Q: Q7: Write a program to read 3 numbers, and write the largest and smallest numbers.
A: Program description: n is user input which stores the number of integers to be read. a is an integer…
Q: 1.Write a program that calculates and produces these two columns sequence numbers using the three…
A: #include <iostream>#include <iomanip> using namespace std; int main(){ cout <<…
Q: 13. Write a program that reads in two integers and determines and prints if the first is a factorial…
A: Required: A program to read two integers and check if the first is a factorial of the second or not.…
Q: 1- Write a program that read N of number. Check if number 3 is existing in the numbers read?
A: I give the code in Python along with the output and code screenshot
Q: 5. Write a program that generates random numbers as below, random number between 0 and 10 Numl Num2…
A: In the below program srand(time(0)); has been used to make sure that each number generated is…
Q: Q4: write a program to read 10 numbers .and print all number is a prime
A: As No Programming language is mentioned, writing this program in C++ Code : #include…
Q: Program file: p4.c What is the sum of the first 50 odd numbers? Write a program that prints just one…
A: C program to find sum of first 50 odd numbers: #include <stdio.h> int main(){ int i, sum=0;…
Q: Write a Program to find all Roots of a Quadratic Equation
A: a,b, c are coefficients where x can be calculayed by: x = [-b +- (b^2 - 4ac)^1/2] /2a D = b^2-4ac is…
Q: 7. Write a program that calculates the value of (pi) from the following series. Stop caleulation…
A: Since no programming language is mentioned, I am using python. 7. Algorithm: Start Initialize…
Q: 1.write a program to find the average of even and the average of odd numbers from 20 entered…
A: Hi, Since there are multiple questions in this post, as per our policy, I'll answer the first…
Q: 3- Write a program to read a sequence of integers (n), then print the number of the positive and…
A: Start Input value of n from user For n times Input number If number greater than 0, then increment…
Q: 7. Make a program that will convert an inputted number in inches (in.) and display its equivalent…
A: The problem is based on the basics of C programming language.
Q: 9. Write a program which asks the user for their score on the exam. Display their letter grade based…
A: Ans: Code: grad = input('Grad> ') if grad >= 90 fprintf('A'); elseif grad >= 80…
Q: 16. Write a program that will display the following pattern, given the value of n and m. Example if…
A: We have to write a C program to print the pattern as given. Here n (number of columns) and m (number…
Q: 2. Write a code that will output the Fibonacci Series up to 50 numbers that starts with 11
A: Kindly Note: As per our guidelines we are supposed to answer only first question. Kindly repost…
Q: 2)If a five-digit number is input through the keyboard, write a program to print a new number by…
A: Below is the C++ code. Approach of Program: Include a necessary header files and use a namespace to…
Q: s Write a program to read three numbers and prints the biggest one. طباعة ارقم الأكر من ثلالة ارقام…
A: Question :-
Q: The powers of 2 are: 1, 2, 4, 8, 16, 32, .. . Write a program to display the first power of 2, which…
A: Here i am using C++ program.
Q: Q5): write a program to read an integer from 1 to 7 and print th name of the day in a week.
A: Using array of weekdays: Or alternative code using switch statement:
Q: 6-Write a program to display the following output: Student Marks: Maths = 90 Physics = 77 Chemistry…
A: Algorithm: 1.Using main function 2.printing the statements as required 3.end
Q: 9.Write program to print all the numbers divisible by 4 and 5 up to a number of N(entered by user…
A: I have given an answer in step 2.
Q: 3. Write a program that will input non-negative integer and would display the prime factors of the…
A: Here is the approach to achieve this :- Get the input from the user and call the prime factor…
Q: 1. Write a program that takes a two digit number and prints the number backwards.
A: As per the rules of Bartleby i can only solve 1 question at a time if they are not interrelated so…
Q: 3. Write a program to add the following numbers and save the result in R20. Ох25, 0х 19, Ох12
A: Given: Write a program to add the following numbers and save the resut in R20. Given numbers:…
Q: Q2) Write a program to read a group of numbers between 1 to 100, then find the sum of the even…
A: "Since you have not mention any programming language, so we will write our program in C++ language."…
Q: 5- Write a program which read a number consists of 4 digits and find the maximum digit of the…
A: Note: Since no programming language is mentioned. I am attempting this in python. if you need it in…
Q: 2. Write a program that displays the result of (9.5 * 4.5 - 2.5 * 3) / (45.5 3.5) 2a. Rewrite using…
A: 2. code snippet with output:
Q: Q2- Write a program to read a number (n). Then print all numbers from 0 to n that are not equal to 1…
A: #Note no programming is mentioned so i was used python programming language for i in…
Q: Question 3 Enter 10 numbers (1-10), Print odd and even numbers. The output of your program should…
A: 1) Since you have not specified programming language I have written program in python 2) Below is…
Q: 2.2 Write a program to generate 10 random numbers in the range [-0.5,0.5] and print them in the…
A: Write a C++ program to generate 10 random numbers in the range [-0.5,0.5] and print them in the…
Step by step
Solved in 3 steps with 1 images
- What is the output of the following program? (6) #includeiostreamusingnamespacestd;voidfunc1();voidfunc2();intmain()intnum;coutEnter1or2:;cinnum;coutendl;coutTake;if(num1)func1();elseif(num2)func2();elsecoutInvalidinput.Youmustentera1or2endl;return0;voidfunc1()coutProgrammingI.endl;voidfunc2()coutProgrammingII.endl; What is the output if the input is 1? What is the output if the input is 2? What is the output if the input is 3? What is the output if the input is -1?Suppose that x and y are int variables and the input is: 10 20.7 What is the value of x and y if the inputs are already executed: cout << x << y;4. Write a program that prompts the user to enter a greeting and a name. The program should output the greeting combined with the name, such as "How's it going, Steve?".
- A palindrome is a word or a phrase that is the same when read both forward and backward. Examples are: "bob," "sees," or "never odd or even" (ignoring spaces). In python, write a program whose input is a word or phrase, and that outputs whether the input is a palindrome. Ex: If the input is: bob the output is: bob is a palindrome Ex: If the input is: bobby the output is: bobby is not a palindrome Hint: Start by removing spaces. Then check if a string is equivalent to its reverse.a.Write a python program that asks the user to enter two integer numbers and then perform addition,subtraction, multiplication, and division using these 2 numbers. Then display (print) the results. b. Write a python program that displays converts the binary numbers 100 and 110 to decimal anddisplay them. Then add the two numbers and display the result in decimal, binary, octal, andhexadecimal.to b? What value will be assigned to c?4. What will the following program display?def main():x = 1y = 3.4print(x, y)change_us(x, y)print(x, y)def change_us(a, b):a = 0b = 0print(a, b)main()
- Develop a program that1- Would read an input from the keyboard. The input should be a whole positive number.2- Then display each digit, starting with the rightmost digit.3- At last, decide if the number if divisible by 9 or not.a. Calculate and display the sum of the digits.b. Display whether the input number is divisible by 9 or not.4- Ask the user if they would want to evaluate another number. Repeat the program if the answer is yes. Abort if they’re done.1. Write a program that helps a stock market investor understand how much they've made when selling Acme Software, Inc. stock. 2. Ask your user how many shares of Acme Software, Inc. they purchased. 3. And ask your user how much they paid per share. 4. Then, assume that your user sold the same number of shares they had purchased some time later. 5.Ask your user at what price they sold the shares. 6. In both instances, the purchase and sale, your user had to pay their stockbroker a commission that amounted to 2% of the amount paid for the stock as well as the amount received for the stock. 7.Then, display: a) The amount your user paid for the stock. b) The amount of commission your user paid their stockbroker when they bought the stock. c) The amount your user sold the stock for. d) The amount of commission your user paid their stockbroker when they sold the stock. e) The amount of profit that your user made after selling the stock and paying the two commissions to their broker.…Write a program that converts change into formatted dollars and cents It should do the following: Prompt the user for their change in Quarters, Dimes, Nickels, and Pennies Read the associated integers from the keyboard Calculate the result Use printf to display the output as $d.cc A sample run with inputs 6, 5, 4, 3 must look like: (plural is ok even when grammatically incorrect) Enter the number of quarters: 6 Enter the number of dimes: 5 Enter the number of nickels: 4 Enter the number of pennies: 3 You entered: 6 quarters 5 dimes 4 nickels 3 pennies The total in dollars is $2.23 A sample run with inputs 1, 2, 3, 2 must look like: Enter the number of quarters: 1 Enter the number of dimes: 2 Enter the number of nickels: 3 Enter the number of pennies: 2 You entered: 1 quarters 2 dimes 3 nickels 2 pennies The total in dollars is $0.62 Hint: Use printf to ensure there is at least 1 digit to the left of the decimal point and at…
- When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This adjustment can be done by normalizing to values between 0 and 1, or throwing away outliers. For this program, adjust the values by dividing all values by the largest value. The input begins with an integer indicating the number of floating-point values that follow. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('{:.2f}'.format(your_value)) Ex: If the input is: 5 30.0 50.0 10.0 100.0 65.0 the output is: 0.30 0.50 0.10 1.00 0.65 pythonWhen analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This adjustment can be done by normalizing to values between 0 and 1, or throwing away outliers. For this program, adjust the values by dividing all values by the largest value. The input begins with an integer indicating the number of floating-point values that follow. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('{:.2f}'.format(your_value))2- Write a Python program that determines a student’s grade. The program will read three types of scores(quiz, midterm, final exam scores) and determine the grade based on the following rules : if the average score >=90% =>grade=A -if the average score >= 70% and <90% => grade=B -if the average score>=50% and <70% =>grade=C -if the average score<50% =>grade=F Example Input : Quiz score: 80 Mid-term score: 68 Final score: 90 Output: Your grade is B.