CODE:
import java.util.*;
class Sum{
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
System.out.print("Enter Value m: ");
int m = console.nextInt(); // Taking input m (No of digits)
System.out.print("Enter Value a: ");
int a = console.nextInt(); //Taking input value a
System.out.print("Enter Value b: ");
int b = console.nextInt(); //Taking input value a
int carry=0; // set carry to 0
int i=0; // set i to 0
// ci is for storing ci value
// c is for storing finall value
// d is for increment the digits length of c so that we can add
every ci to c
int j,ci=0,c=0,d=1; // Declaring required variables
while(i<= m-1){ // Loop while i <= m-1
ci = carry + (a%10) + (b%10); // Adding carry and ai and ci
if(ci>=10){ //when ci > 1=
ci = ci -10; //Subtract ci-10
carry = 1; // set carry = 1
}
else
carry = 0; // else set carry = 0
c = ci*d+c; // add ci value to c
a = a/10; // removing ai digit
b = b/10; // removing bu digit
d= d*10; // increment d
i++; // incrementing i fot next iteraions
}
c = carry*d+c; // set cm to the value of carry
System.out.println("Final answer c is : "+c); // printing value
c
}
}
CODE ATTACHMENTS:
OUTPUT:
ci is for storing ci value
c is for storing finall value
d is for increment the digits length of c so that we can add every
ci to c
Please Dont forget to UPVOTE my solution and Comment if you have any Doubts.
do in java FIGURE 1.2 Given: m 2 1 and two positive numbers each containing m...
1. Write net ionic equations for ALL precipitation reactions of each anion studied in this e with Ag'(aq) and Ba (a), respectively, (in the absence of HNO,) at Bad 2 ptt disalve 51 과 IND Add about 10 drops of deionized water and 10 drops of 6 MNH, to the precipitate and mix thoroughly. Note that the Agl precipitate will persist; Agl is not soluble in NHs solution Confirmation Test for lodide Carry out confirmatory test for iodide as follow:...
Answer B
java
Problem 2 For each problem given below, do the following: 1. Create an algorithm in pseudocode to solve the problem. 2.Identify the factors that would influence the running time of your algorithm. For example, if your algorithm is to search an array the factor that influences the running time is the array size. Assign names (such as n) to each factor. 3. Determine the number of operations in each step of the pseudocode. To do that, identify...
N3M.12
between figure the acceleration arrow you should draw through each position dot during step 1 should point from the puck's position at that instant toward the table's center, since the Ca string's tension force acts in that direction.] (b) Check your work using the Newton program. N3M.12 In this problem, we will explore the necessary con- t ditions for uniform circular motion. (a) According to chapter N1, an object moving in a circle of radius rat constant speed llexperiences...
1. In a small beaker mix together 5.0 mL of 0.10 M Co(NO3)2 . 6H2O with 5.0 mL of concentrated HCl. Be sure to mix thoroughly with your glass stirring rod. This is your equilibrium mixture. 2. Place 1.0 mL of your equilibrium mixture in a small test tube add 1.0 mL of concentrated HCl. Observe any color changes and state in which direction (if any) the equilibrium shifted. Place a new 1.0 mL sample of your equilibrium mixture in...
1. If we had two 4-bit signed 2's complement numbers, X--4 and Y-6 and we wanted to compare them, we might calculate X-Y (a) Show that calculation (b) Explain how the result tells us that Y>IX (c) Now show the calculation for Y. X (d) Explain how this also shows us that Y>X 2. We talked about an ALU that takes two 4-bit inputs, A and B, and then generates a 4-bit result, S, based on a 2-bit command, F1FO....
Java Programming
The program template represents a complete working Java program
with one or more key lines of code replaced with comments. Read the
problem description and examine the output, then study the template
code. Using the problem-solving tips as a guide, replace the /* */
comments with Java code. Compile and execute the program. Compare
your output with the sample output provided. Modify class Time2 to
include a tick method that increments the time stored in a Time2
object...
please answer as many questions as possible. I will “thumb up” the
answers. Thanks!
1. You are on a boat, which is bobbing up and down. The boat's vertical displacement y is given by y 1.2 cos(t). Find the amplitude, angular frequency, phase constant, frequency, and period of the motion. (b) Where is the boat at t 1 s? (c) Find the velocity and acceleration as functions of time t. (d) Find the initial values of the position, velocity, and...
Need help for questions 2 and 4
G. C. 1-7 Determination of the Dye Concentration in a Powdered Drink G. C. 1-7: PART 2 GROUP DISCUSSION QUESTIONS Lab partners' name: 1. Your TA will provide you with the correct concentration of the dye in the powdered drink solution. Calculate the percentage error for your data. (experimental value - accepted value) accepted value 2. The empirical formula for the Brilliant Blue dye is CanHyN,O,S, Na2 and the formula weight i 79286...
Can you please help me with creating this Java Code using the following pseudocode? Make Change Calculator (100 points + 5 ex.cr.) 2019 In this program (closely related to the change calculator done as the prior assignment) you will make “change for a dollar” using the most efficient set of coins possible. In Part A you will give the fewest quarters, dimes, nickels, and pennies possible (i.e., without regard to any ‘limits’ on coin counts), but in Part B you...
Suppose there are two firms, 1 and 2, each with M C = AC = 10. They each choose quantities of output, y1 and y2. The market demand is p= 70−2y, where y=y1+y2. Each firm discounts the future at rate δ <1per period. a. [6 marks] First calculate the Cournot equilibrium outputs. Call these y∗1 and y∗2. b. [4 marks] Next, calculate how much each firm would produce if the two firms colluded to act as a monopoly. Call these...