Write a set of statements to perform the following steps: When the variable fruit contains the character uppercase P, increase the value in the integer variable papaya by one. When fruit contains the character uppercase G, increase the value in the integer variable guava by one. When fruit contains anything else, increase the value of the integer variable bananas by one.
C LANGUAGE
Hi, Please find my answer. Please let me know in case of any issue.
Given:
char fruit[SIZE] = // declare
int i;
int papaya = 0, guava = 0, bananas = 0;
for(i=0; i<SIZE; i++){
if(fruit[i] == 'P')
papaya++;
else if(fruit[i] ==
'G')
guava++;
else
bananas++;
}
Write a set of statements to perform the following steps: When the variable fruit contains the...
2. a)Write the ARM ALP conditional code snippet for the following statements written in C-language. Assume R1 to Rn as06 variables Let R1, R2, R3 contain the starting addresses of arrays X, Y and Z respectively Use Register R4 for variable i. Display appropriate messages. While (i+10) else Z[i] XiYi; b)i Write a program to display a message "This is an examination Question" on the screen using 06 a function sub program Note the following Address of the string to...
write Java statements that perform the following functions ? 21 If x is greater than or equal zero, then assign the square root of x to variable sqrtx and print out the result Otherwise, print out an error message about the argument of the square root function and set sqrtx to zero (2) 22 A variable fun is calculated by dividing variable numerator by variable denominator If the absolute value of denominator is less than 1, write "Divide by zero...
rite statements to perform the following: (Hint: You may use combined assignment operators!) a. Add 9 to apples and store the result in apples. b. Divide peaches by 13 and store the result in peaches. c. Subtract 17 from oranges and store the result in oranges. d. Multiply payRate by 1.5 and store the result in payRate. 9. Write statements to perform the following operations: Declare two variables p and q. Subtract 250 from p and store the result in...
In this program, you will be using C++ programming constructs, such as overloaded functions. Write a program that requests 3 integers from the user and displays the largest one entered. Your program will then request 3 characters from the user and display the largest character entered. If the user enters a non-alphabetic character, your program will display an error message. You must fill in the body of main() to prompt the user for input, and call the overloaded function showBiggest()...
You perform the following steps: 1. Heat up a balloon that contains 4 mol of helium gas from 293K to 353K.... Problem 2. You perform the following steps: 1. Heat up a balloon that contains 4 mol of helium gas from 293K to 353K. (pressure inside of oven is2 atm) 2. Very slowly squeeze the balloon until the volume decreases from 0.5L to 0.25L 3. Grab the balloon, put it in a container that does not allow it to change...
Write a program(Python language for the following three questions), with comments, to do the following: Ask the user to enter an alphabetic string and assign the input to a variable str1. Print str1. Check if str1 is valid, i.e. consists of only alphabetic characters. If str1 is valid Print “<str1> is a valid string.” If the first character of str1 is uppercase, print the entire string in uppercase, with a suitable message. If the first character of str1 is...
Write a sequence of normal assembly language instructions corresponding to the following sequence of high-level language statements. Assume that each variable (A, B. C, and D) is one word in memory. If notequalto B then C: =5; else C: =10; D: =50;
Which response contains all the following statements that are true, and no others? I. A set of sp2 orbitals can be thought of as one s orbital one-third of the time and two p orbitals two-thirds of the time. II. A set of sp orbitals can accommodate a maximum of six electrons. III. The orbitals resulting from sp3d2 hybridization are directed toward the corners of an octahedron. IV. A set of sp3 orbitals results from the mixing of one s...
Problems: 1. Write a program to define the following variables, assign them values, and print their values on screen: Integer x = 20, Float y = 40.45 Double z = 91.51e+5 Char w = A • • For the integer variable x, you need to print it in decimal notations, octal notations and hexadecimal notation. For the double variable y, you need to print it in double notations and scientific notation. 2. Write a program with the following three parts:...
The second project involves completing and extending the C++ program that evaluates statements of an expression language contained in the module 3 case study. The statements of that expression language consist of an arithmetic expression followed by a list of assignments. Assignments are separated from the expression and each other by commas. A semicolon terminates the expression. The arithmetic expressions are fully parenthesized infix expressions containing integer literals and variables. The valid arithmetic operators are +, –, *, /. Tokens...