Question

using C++. Sum  x and y (start it from x) and stores in a variable z, and...

using C++. Sum  x and y (start it from x) and stores in a variable z, and output the z on screen.

int x = 10;

int y = 20;

int z = _________ ________ _________ ;

cout << ________ ;

0 0
Add a comment Improve this question Transcribed image text
Answer #1

// Screenshot of the code

// Sample output

// Code to copy

#include<iostream>
using namespace std;
int main()
{
   int x = 10;
int y = 20;
int z = x + y;
cout << z;
   return 0;
}

Add a comment
Know the answer?
Add Answer to:
using C++. Sum  x and y (start it from x) and stores in a variable z, and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • #include <iostream> #include <cmath> using namespace std; int main() { int x; int y; int z;...

    #include <iostream> #include <cmath> using namespace std; int main() { int x; int y; int z; int r1; int r2; cin >> x; cin >> y; cin >> z; r1 = 4* pow(x,3)-5*pow(y,2)+3*z; r2 = r1+7*pow(x,3)-2*pow(y,2)+11*z; cout << "r1="; cout << 4* pow(x,3)-5*pow(y,2)+3*z; cout << endl; cout << "r2="; cout << r1+7*pow(x,3)-2*pow(y,2)+11*z; cout << endl; cout << "r3="; cout << r2-9*pow(x,3)+22*pow(y,2)-6*z; cout << endl; return 0; } 1-115 Your output r2-395 13-186 5:Compare output Output differs. See highlights below. -163...

  • Random variable (20) Z X+Y is a random variable equal to the sum of two continuous...

    Random variable (20) Z X+Y is a random variable equal to the sum of two continuous random variables X and Y. X has a uniform density from (-1, 1), and Y has a uniform density from (0, 2). X and Y may or may not be independent. Answer these two separate questions a). Given that the correlation coefficient between X and Y is 0, find the probability density function f7(z) and the variance o7. b). Given that the correlation coefficient...

  • What will be the output produced from the following nested loops: sum = 0; a =...

    What will be the output produced from the following nested loops: sum = 0; a = 7; while (a<10) {       for (k = a; k<=10; k++)                   sum +=k;       a++; } cout<< sum << endl; int x, y; for (x = 1; x<=5; x++) {       cout<<x<<endl;       for (y = 2; y <x; y++)                   cout<< y<<endl; }

  • Module halfadder(sum, cout, x, y); input x, y; output sum, cout; assign sumxy; assign cout-x&y; B...

    please fill in the wire, four gates and , calling the half adders module halfadder(sum, cout, x, y); input x, y; output sum, cout; assign sumxy; assign cout-x&y; Bo endmodule module multiplier(C, A, B); input [1:0] A, B; Cs C C1 Co output [3:0] C; //declare internal wires // four and gates // call halfadder twice Bo HA HA c, c2 Co endmodule module halfadder(sum, cout, x, y); input x, y; output sum, cout; assign sumxy; assign cout-x&y; Bo endmodule...

  • What is the output of the following program? int main(void) { int x, y, z; x...

    What is the output of the following program? int main(void) { int x, y, z; x = 5; y= test(x); z= x + y; cout<< setw(4)<<x <<” + “<<setw(4)<<y<<”=” << setw(4)<<z<<endl; return 0; } int test (int x) { int w; w = x + 10; return (w); }

  • My C++ program is give me extra characters in my output. Below is an example of input.txt and the section of code that reads it. input.txt (x/y), x = 20, y = 5; ((y>x)&(x<z)),x=5,y=10,z=3; o...

    My C++ program is give me extra characters in my output. Below is an example of input.txt and the section of code that reads it. input.txt (x/y), x = 20, y = 5; ((y>x)&(x<z)),x=5,y=10,z=3; output I get: Value=4 20, y=5; Value=0z)), x=5, y=10, z=3; ifstream fin;         fin.open("input.txt");     while (true)     {         symbolTable.init();         fin.getline(line, SIZE);         if (!fin)             break;         stringstream in(line, ios_base::in);         in >> paren;         cout << line << " ";         expression = SubExpression::parse(in);         in >> comma;         parseAssignments(in);         double result = expression->evaluate();         cout...

  • 61. The following program is accepted by the compiler:         int sum( int x, int y...

    61. The following program is accepted by the compiler:         int sum( int x, int y )         {             int result;             result = x + y;            }                            T__   F__ 62. The following implementation is accepted by the compiler:         void product()         {             int a; int b; int c; int result;             cout << "Enter three integers: ";             cin >> a >> b >> c;             result = a * b * c;            ...

  • 18 C++ 1. What is the output of the following program segment? int y-22: while ((y...

    18 C++ 1. What is the output of the following program segment? int y-22: while ((y 3) != 0) cout << y<< "": y=y-2; The output is 2. Suppose that the input is 100, 20,-8, 50, 20. What is the output of the following C++ code? int sum0 int num: int j cin >> num: if (num < 0) continue зит зит + num; cout<< sum << endl; The output is

  • 12. What is the output of the following C++ code? int x; int y; int *p...

    12. What is the output of the following C++ code? int x; int y; int *p = &x; int *q = &y; *p = 35; *q = 98; *p = *q; cout << x << " " << y << endl; cout << *p << " " << *q << endl; 13. What is the output of the following C++ code? int x; int y; int *p = &x; int *q = &y; x = 35; y = 46; p...

  • A. What is the output of the following C++ code fragment? (all variables are of type...

    A. What is the output of the following C++ code fragment? (all variables are of type int) int count-1; int y-100; while (count 3) y=y-1 ; count+t cout << y << endl; cout<< count <<endl What is the value of x after control leaves the following while loop? (all variables are of type int) B. int x0 while (x < 20) sum- sum+x cout << sum<< endl;

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT