Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Write a code that reads integers from the user until the user enters either 0 or 100. Then prints the sum of the numbers entered (excluding the 0 or 100).




What is the output of each of the following statements? Assume that

x = 5, y = 2, z = 10, and temp = 0

 

6. if (x + y > z)

      x = y + z;

   else

      x = y - z;

   cout<< x << " " << y << " " << z << endl;


What is the output of each of the following statements? Assume that

x = 5, y = 2, z = 10, and temp = 0

 

 


1. if (y >= x)

      y = z;

   cout<< x << " " << y << " " << z << endl;

 

2. if (y >= x)

   {

      y = z;

      cout<< x << " " << y << " " << z << endl;

   }

 

3. if (z < y)

      temp = x;

      x = z;

   z = temp;

   cout<< x << " " << y << " " << z << endl;

 

 

4. if (z > y)

   {

      temp = x;

      x = z;

      z = temp;

   }

   cout<< x << " " << y << " " << z << endl;

 


5. if (x >= 6)

   cout<< x + y << endl;

   cout<< x + y << endl;

 

 

 

6. if (x + y > z)

      x = y + z;

   else

      x = y - z;

   cout<< x << " " << y << " " << z << endl;

 

 



Create a c++ program the counts and display the odd and even numbers among the ten input values using a two dimensional array.


First row - 10 input numbers

Second row - even numbers

Third row - odd numbers


Create a class named 'Rectangle' with two data members- length and breadth and a function to calculate the area which is 'length*breadth'. The class has three constructors which are:


1 - having no parameter - values of both length and breadth are assigned zero.

2 - having two numbers as parameters - the two numbers are assigned as length and breadth respectively.

3 - having one number as parameter - both length and breadth are assigned that number.

Now, create objects of the 'Rectangle' class having none, one and two parameters and print their areas.



You are given an array A consisting of N integers. 

Task

Print the sum of the elements in the array. 

Note: Some of the integers may be quite large.

Input Format

  • The first line contains a single integer N denoting the size of the array.  
  • The next line contains space-separated integers denoting the elements of the array.

Output format

Print a single value representing the sum of the elements in the array.

Constraints

1<=N<=10

 0<=a[i]<=10^10


Write a program that lets user enter in a potentially unlimited series of subject marks from 0 to 100. Ensure that the numbers entered are greater than 0 and less than 100. You cannot assume that the user will enter an integer or a float. User can enter both float and integer values. If they input a negative number or a number more than hundred you should continually prompt them to enter a valid number until they do so. When the user enters a the line ”end” you should stop collecting marks. 

Then use their input to generate a summary report that includes Total marks, Average mark, Highest mark and the lowest mark. Sample output is given below. 

Enter a mark, 0 to 100: apple

That's not a valid mark!

Enter a price, 0 to end: -5

Marks must be positive!

Enter a mark, 0 to 100: 10

Enter a mark, 0 to 100: 20

Enter a mark, 0 to 100: 30

Enter a mark, 0 to 100: 40

Enter a mark, 0 to 100: 50

Enter a mark, 0 to 100: end

Total marks: 150.0

Average marks: 30.0

Highest mark: 50.0

Lowest mark: 10.0


Given class Triangle (in files Triangle.h and Triangle.cpp), complete main() to read and set the base and height of triangle1 and of triangle2, determine which triangle's area is larger, and output that triangle's info, making use of Triangle's relevant member functions. 

Ex: If the input is:

3.0 4.0
4.0 5.0

where 3.0 is triangle1's base, 4.0 is triangle1's height, 4.0 is triangle2's base, and 5.0 is triangle2's height, the output is:

Triangle with larger area:
Base: 4.00
Height: 5.00
Area: 10.00

Write a C++ program that displays the row numbers of a matrix containing at least two even


numbers. First, the program should create a 2D array (5 rows, 5 columns). Then, ask the user to


input values in the matrix or 2D array. After that, program should display row number (or index)


which has less than 2 prime numbers. If no row (of the matrix) contains at least two prime


numbers then the program should display the message “No row found containing two prime


numbers”.

Write a program that creates and then reads a matrix of 5 rows and 5 columns of type int. while


reading; the program should not accept values greater than 100. For any entered value greater


than 100, the program should ask for input repeatedly. After reading all numbers, the system


should find the smallest number in the matrix and its location or index values. The program


should print the smallest number and its location (row and column) and also print their count.

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS