C++ Programming: From Problem Analysis to Program Design
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
Students have asked these similar questions
In each of the following code snippets, data is copied from x to y. How many bytes of data arecopied? The answer should be a C expression.Example: int x[10], y[10];...for (int i=0; i<10; i++)x[i] = y[i];Answer: 10*sizeof(int)Example: int *x, *y; ...; y = x;Answer: sizeof(int*) (e) int x=10, y=x;(f) int x[10]; int *y = x;(g) int x[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};void f(int y[5]) { ... }int main() { f(x); }(h) int x[10], y[10];...memcpy(y, x, 5*sizeof(int));
Modify the program by removing the inner loop. To do this, make sure there should be three input voltages for each piece of equipment. Code: using System;class Program{  static void Main()   {      // Input the voltage data      double [,] mat = {{1081,223.7,222.5,223.0},                        {2061,220.2,227.0,225.1},                        {2405,221.7,224.9,226.0},                        {3368,222.9,223.8,226.7}};                              int i,j;            // Compute the Average of voltage of each equipment and all voltages      double total = 0.0;      for(i=0;i<4;i++)      {          double sum = 0.0;          for(j=1;j<4;j++)          {              sum = sum + mat[i,j];                         }             total = total + sum;          Console.WriteLine("Average voltage of equipment number : "+mat[i,0]+" = "+(sum/3));      }            Console.Write("Average of all voltages = "+(total/12));  }}
4.16 In Python, Write a program whose input is two integers. Output the first integer and subsequent increments of 10 as long as the value is less than or equal to the second integer. Ex: If the input is: -15 30 the output is: -15 -5 5 15 25 Ex: If the second integer is less than the first as in: 20 5 the output is: Second integer can't be less than the first. For coding simplicity, output a space after every integer, including the last.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning