- Question: Write a program that accepts a set of integer numbers. Your program should count the number of even numbers and find the maximum even. Use -1 to stop your data entry. Sample Input/ Output: Enter integer numbers, Use -1 to stop your data entry. 12 5. 33 66 -1 There are 2 even numbers. The maximum even number is 66.
Q: The following section of code assigns the indicated values to a bod bool a; int w = 10, x = 15, y =…
A: int w=10,x=15,y=20,z=25; a=(w<y) && (y>z) && (x>w); && means…
Q: Rahul is a maths genius so he came up with a game and as raj is Rahul's best friend so Rahul decided…
A: Required: i want code in python Rahul is a maths genius so he came up with a game and as raj is…
Q: What is the output of the following code snippet if count contains 56? if count % 2 == 0 : print…
A: In Python programming language, the semicolon after a statement is optional but it strongly follows…
Q: What is the value of the expression m+m/n+m+m%n? Assume that, int m=18, n=4;
A: Here m=18; n=4; m + m/n +m + m%n m =18, n =4 18 + 18/4 + 18 + 18%4 = 18 + 4 + 18 + 2 =…
Q: The following code segment does not work as intended! int count = 1; int total = 0; while (count…
A: Given is a program to calculate the sum of numbers from 1 to 100 with error.
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: The output is: int main() { double numbers[] = {2, 4, 6, 1, 3, 2}; %3D double sum = e; double count…
A: Coded using C++.
Q: This is a segment of program, when it executed with multiple values for n and s the program displays…
A: Given code: #include <iostream> using namespace std; int main(){ int x, y; int f;…
Q: 15.Write program to prints "OK" if each digit in the number (Num) divisible by N, otherwise prints…
A: use % operator to fetch all digit of num. Check it is divisible by N or not for each digit.
Q: Q1: Write a program that reads a set of N integers. Then, the program finds and outputs the sum of…
A: Below I have provided a python program for the given question. Also, I have attached a screenshot of…
Q: Question 2 a- Write a program that accepts positive integers and sums up the even numbers. a. The…
A: Java is a platform and a programming language. Java is a general-purpose programming language that…
Q: How would I go about writing the code in the problem in the picture?
A: Program AlgorithmCreate a class Prime_Numbers and define the main() function.Initialize the required…
Q: 3. Write a program that accepts two input numbers and compute the Greatest Common Divisor using…
A: #include <iostream>using namespace std; int main(){ char ch; int n1, n2; do {…
Q: Assignment 3 Write a complete program that accepts two integer numbers num1 and num2, where num1 <…
A: You didn't specify any language for the problem, so i am doing it in C++ programming Langauge.…
Q: Given x 0, y = 1, count = 3. After the following code is executed, count ++; y=x; if (x < 0)…
A: Given: x=0 , y=1, count =3 Given code: count++ y=x if x < 0 count-- else count++
Q: 1- What is the output of the following A= (!(3 = = 3) && (9>5)); B= (66 > 6); C= ((2 > 0) || (7<0));
A: AND OR operators-
Q: 1. Write a program that does the following: - reads an unspecified number of integers - determines…
A: As per our guidelines we answer only first question .Please post other question separately. The…
Q: Can you help me with the codes required for this assignment? the programming langauge is Java.…
A: Given: Can you help me with the codes required for this assignment? the programming langauge is…
Q: The output of int(5.5) is: 05.0 06.0 05 05.5
A: Given function is, int(5.5) int is a data type which refers integer numbers. 5.5 is a floating point…
Q: Write a program that allows the user to enter a number between 1 and 1000. If the number is…
A: import math def isPrime(n): if (n <= 1): return False if (n <= 3): return…
Q: nt x=10; if(x++ >10) { x =13; }
A: Given: int x=10; if(x++ >10) { x =13; }
Q: Make a tunction that calculates the CUBE-ROOT of the input number and returns the value (single or…
A: It is defined as a computer programming language. It was developed by Denis Ritchie in 1970. Each C…
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: Write pseudo code that will calculate a running sum. A user will enter numbers that will be added to…
A: # initialize sum = 0 summ = 0 # an infinite loop while True: # taking input num =…
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: Question4: Write a program to take input an integer n followed by n integers. Program should check…
A: According to the Question below the Solution; Output:
Q: 1: Volume.cpp) Write a program that reads a radius and prints the volume and surface area of the…
A: #include <iostream>using namespace std;int main() { float radius,volume,surface_area;…
Q: Write C ++ program, to read A (n, n) of numbers, then put 5 instead each odd positive number.
A: Required: Write C ++ program, to read A (n, n) of numbers, then put 5 instead each odd positive…
Q: Q3:- / a: Write a Quick Basic program to compute S value where : S=1+ 1/3+1/5+1/7+ .1/n
A: Use a loop to start from 1 to n with increment of 2 . Set sum=0 Use formula sum=sum+ (1.0/i)…
Q: The following code will print int n=2, m=3, *p; p=&m; p=&n; n=*p; printf("%d\n", n);
A: Here in the code, the concept of the pointer is used for printing the value of p. The Pointer in C…
Q: 1. Write a program called PrimeDigits, which reads from the user an integer n, and then prints out…
A: As no programming language is mentionedwriting this pr import java.util.Scanner; public class…
Q: s Write a program to read three numbers and prints the biggest one. طباعة ارقم الأكر من ثلالة ارقام…
A: Question :-
Q: Write a function that prints the ASCII values of the char- acters using the following header: void…
A: Programs are the general instructions given to the system in the form of codes, using the…
Q: Given x 0, y = 1, count = 3. After the following code is executed, count ++; y=x; if (x < 0)…
A: EXPLANATION :- Since, x = 0, y = 1, count = 3 (given) count++; (that means count = count +1 i.e., 3…
Q: Write the output of the following code. int count=3; count++; if(count/2==1) count--;…
A: The Correct Option is b) 4
Q: my code in python is giving me problems can you please help me with what is wrong para1 =…
A: In the given question, we have given the python code. The given code needs to be checked against…
Q: - Create a program that generates random numbers between (1 and 10) 10 times and calculates he total…
A: Python program to generate 10 random number. The range of the random number is 1 and 10. Calculate…
Q: void main () { int x, у, z; x =10; y = 17; z = x + y; y = y - x; printf ("x: %d, y: %d, z: %d", x,y,…
A: initially, x = 10 and y = 17. so , z = x + y = 10 + 17 = 27. ( z = 27 ) and y = y - x = 17 - 10 =…
Q: Write only code according to this I don’t need output only code for this same
A: C++ used to answer this question
Q: Write code that keeps reading integers until # or until capital letter is entered. For each read…
A: Note: Answering in python as no language is mentioned. Input : Input number until termination…
Q: Write statements that assign random integers to the variable n in the following ranges: a) 1 ≤n ≤2…
A: Since the programming language is not specified, the following statements are in the C++ language. n…
Q: The following code will print Int X-0; Int y=x + -X; Printf("%d",y);
A: The Output Will be : -1(Option d)
Q: start Get positive integer from user, call it A. Get positive integer from user, call it B. C = A B…
A: According to me correct answer will be Option 4. A**A EXPLANATION answer of flow chart will be in…
Q: Q1: Write C++ program to read two integer numbers then print “multiple” or “not” if one number is a…
A: Note: Multiple questions are given in one part. According to the rule, you will get the answer for…
Q: int x = 8, y = 3, z = 5; x += x + y * z + z * z; printf("%i\n", x); // what is the output
A: Given: int x = 8, y = 3, z = 5; x += x + y * z + z * z; printf("%i\n", x); // what is the output
Q: it doesn't end when i input 'N' after input N still ask to enter a number def calculate(): while…
A: You are getting that unexpected behavior because after user entered N you didn't exit from the while…
Q: The following code will print Int X=1; Int y=x + ~x; Printf(“%d”,y);
A: We need to print the output for the logic: Int X=1; Int y=x + ~x; Printf(“%d”,y);
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: Suppose the input is 2 3 4 5 0 (one number per line). What is the output of the following code?…
A:
Step by step
Solved in 4 steps with 2 images
- c# Write program that asks to enter an x numbers and sum the even numbers and odd numbers separately then print the sum?1. a)Correct code to output the following:0 2 4 6 8 10 12 14 16 18 b) then rewrite the code so that it uses while loop int[] numbers = new int[10]; for(int i=0; i < numbers.length; ++i) numbers[i] = i * 2; for(int i=0; i < numbers.length; i++) System.out.print(numbers[++i] + " "); System.out.println();Modify the following program so it can add two numbers between the values 0 and 9. The current program only handles one digit as the sum. Your program must handle up to 9 + 9 as input and output up to 18. Here is the starter program: .ORIG x3000 ; begin at x3000; input two numbersIN ;input an integer character (ascii) {TRAP 23}LD R3, HEXN30 ;subtract x30 to get integerADD R0, R0, R3ADD R1, R0, x0 ;move the first integer to register 1IN ;input another integer {TRAP 23}ADD R0, R0, R3 ;convert it to an integer; add the numbersADD R2, R0, R1 ;add the two integers; print the resultsLEA R0, MESG ;load the address of the message stringPUTS ;"PUTS" outputs a string {TRAP 22}ADD R0, R2, x0 ;move the sum to R0, to be outputLD R3, HEX30 ;add 30 to integer to get integer characterADD R0, R0, R3OUT ;display the sum {TRAP 21}; stopHALT ;{TRAP 25}; dataMESG .STRINGZ "The sum of those two numbers is: "HEXN30 .FILL xFFD0 ; -30 HEXHEX30 .FILL x0030 ; 30 HEX.END
- Encryption is commonly used to disguise messageson the internet. A Caesar cipher performs a shift ofall of the characters in a string (based on their ASCIIvalues, see Table 2.1), e.g.h e l l o → m j q q tThe example shows a shift with a distance of 5characters, i.e. h(ASCII:104) → m(ASCII:109)Write a C/C++ program that asks the user to input aline of plaintext and the distance value and outputsan encrypted text using a Caesar cipher, with theASCII values range from 0 through 127. Useunderscores (ASCII: 95) to represent spacecharacters.Underscore characters should not be encrypted,and any character that is encrypted may notbecome an underscore. In this case, the charactershould be changed to the next character in theASCII table.The program should work for any printablecharacters.NB: No strings (datatype) or library functions maybe used.See Figure 2.1 for example output.Q10) What would be the output of the following program?Please note that the operation x % 10 (i.e., x modulo 10) is always the same as the rightmost digit of x (e.g., 123 % 10 = 3).Write a program that prompts the user to enter binary digitsand displays its corresponding decimal value. Here are some sample runs: Enter binary digits (0000 to 1111): 0111 ↵EnterThe decimal value is 7
- Given a number n, identify and print which in the given set of numbers are factors of n. Should there be no factors listed in the set of numbers, print "I'm alone". For example, given the number 36 and the set of numbers 2, 3, 5, 7, 12. Only print the numbers which are factors of 36, which are 2, 3, 12. Input The first line contains the number n; The second line contains how many numbers there are in the set of numbers; The third line contains the set of numbers. INPUT: 36 5 2·3·5·7·12 Output The set of numbers that are factors of n separated by a new line in order of appearance. If there are none, print "I'm alone" OUTPUT: 2 3 12AL= 53 CL=29 ADD AL, CL DAA What is the value of AL after execution? A) 39 B) None C) 7CH D) 35HEncryption is commonly used to disguise messages on the internet. A Caesar cipher performs a shift of all of the characters in a string (based on their ASCII values, see Table 2.1), e.g. h e l l o → m j q q tThe example shows a shift with a distance of 5characters, i.e. h(ASCII:104) → m(ASCII:109)Write a C/C++ program that asks the user to input a line of plaintext and the distance value and outputs an encrypted text using a Caesar cipher, with the ASCII values range from 0 through 127. Use underscores (ASCII: 95) to represent space characters.Underscore characters should not be encrypted, and any character that is encrypted may not become an underscore. In this case, the character should be changed to the next character in the ASCII table.The program should work for any printable characters.NB: No strings (datatype) or library functions may be used.See Figure 2.1 for example output.
- Find the error(s) in the following code: (6)Test 5 > run Enter integer: 7 Factors of all numbers up to 7 1: 1 2: 1, 2 3: 1, 3 4: 1, 2, 4 5: 1, 5 6: 1, 2, 3, 6 7: 1, 7 Test 6 > run Enter integer: 21 Factors of all numbers up to 21 1: 1 2: 1, 2 3: 1, 3 4: 1, 2, 4 5: 1, 5 6: 1, 2, 3, 6 7: 1, 7 8: 1, 2, 4, 8 9: 1, 3, 9 10: 1, 2, 5, 10 11: 1, 11 12: 1, 2, 3, 4, 6, 12 13: 1, 13 14: 1, 2, 7, 14 15: 1, 3, 5, 15 16: 1, 2, 4, 8, 16 17: 1, 17 18: 1, 2, 3, 6, 9, 18 19: 1, 19 20: 1, 2, 4, 5, 10, 20 21: 1, 3, 7, 21 Programming Assignment Your solution will be graded based upon program behavior (passing tests). Your solution will not receive full credit (or receives no credit) if you fail to follow these restrictions: Your program must compile and run. Otherwise it will receive a zero. Add your solution to the provided code template. Do NOT use the do-while statement. Only use the while and for statements where appropriate. Use descriptive variable names. Avoid too short variable names, especially single letter variable names. DO NOT…what sequence of numbers would be printed if the following function were executed with the value of N being 0? def xxx (N): print (N) if (N < 5): xxx (N + 2) print (N)