Skip to content

MyUstaadG

Learn to Serve

  • Computer Science
    • Software
    • Computer Tips
    • Coding
      • Conditional Structures Exercises
      • Loops Exercises
      • Arrays Exercises
      • Python Exercises
    • Microsoft Office
      • MS Excel
      • MS Word
  • Videos
    • Funny Videos
    • Health and Fitness Videos
    • PUBG Videos
    • Technology Videos
  • News
  • Funny
  • Memes
  • Playwright Tutorials
  • Tutorials
  • Toggle search form

Write a program that uses three arrays ‘A’, ‘B’, and ‘C’. It inputs integer values in array ‘A’. In second array ‘B’, it stores the squares of values of array ‘A’ and in third array ‘C’, it stores cubes of the values of ‘A’.

Posted on October 26, 2021 By myustaadg.com
Spread the love

Write a program that uses three arrays ‘A’, ‘B’, and ‘C’. It inputs integer values in array ‘A’. In second array ‘B’, it stores the squares of values of array ‘A’ and in third array ‘C’, it stores cubes of the values of ‘A’. The program should display the contents of three arrays, i.e. ‘A’, ‘B’, and ‘C’.
Suppose array ‘A’ has values: 2, 3, 5, 6, 7
The values of ‘B’ should be: 4, 9, 25, 36, 49
The values of ‘C’ should be: 8, 27, 125, 216, 343

So let’s Write Code:

Introduction to C++ Programming | Download and Install Dev C++ Compiler

Code:

Write a program that uses three arrays ‘A’, ‘B’, and ‘C’. It inputs integer values in array ‘A’. In second array ‘B’, it stores the squares of values of array ‘A’ and in third array ‘C’, it stores cubes of the values of ‘A’.

#include<iostream>
using namespace std;
main()
{
long A[5], B[5], C[5], i;
i = 0;
while(i<=4)
{
cout<<"Enter value in element "<<i<< " of array A ? ";
cin>>A[i];
B[i] = A[i] * A[i];
C[i] = A[i] * A[i] * A[i];
i++;
}
cout<<"Array A \t Array B \t Array C "<<endl;
i = 0;
while(i<=4)
{
cout<<A[i]<<'\t'<<B[i]<<'\t'<<C[i]<<endl; 
i++;
}
}

Hope You will learn Something. Happy Coding.

Visit my YouTube Channel as Well😇 https://www.youtube.com/watch?v=JuIHQ9cLSEw&list=PLbIhkHxfUIItTdcyCb34uRIrPJbXBndIl&index=4

Click on the below Links for more Programming Exercises:

Conditional Structure Exercises: 👉https://myustaadg.com/category/programming-exercises/conditional-structures-exercises/

Array Exercises: 👉https://myustaadg.com/category/programming-exercises/arrays-exercises/

Arrays Exercises, Programming Exercises Tags:and ‘C’. It inputs integer values in array ‘A’. In second array ‘B’ it stores the squares of values of array ‘A’ and in third array ‘C’it stores cubes of the values of ‘A’., array code, Array declaration and initialiaztion in c++, Array Exercises, Array exercises in C++, array in programming, array with example, Arrays, arrays code, arrays declaration in C++, Arrays in C++, arrays in c++ programming, C programming exercises: Array, c++ algorithm, c++ array declaration and initailization, C++ arrays programming exercises, c++ arrays tutorials, c++ tutorials, Construct an Array such that cube sum of all element, Cube of numbers from array - C++, Find three element from different three arrays such that a + b +c, finding sum of cubes (from an array) - c++, hoe to decare a array in c++, how to initalize a array in c++, how to write algoritum for array, initialize arrays in c++, Solved Write a C++ program to calculate the cube of each of element, Sort array after converting elements to their squares, Sort the array according to their cubes of each element, Write a program that uses three arrays ‘A’ ‘B’

Post navigation

Previous Post: Write a program that inputs employees code, names, and salaries of 10 employees in three arrays ‘code’, ‘name’, and ‘salary’ It computes the net salary.
Next Post: Write a function, and a program to test it, that will place a zero in each element of array passed to it from the calling program.

More Related Articles

Write a program that inputs values into a one-dimensional array and finds odd and even Numbers. Arrays Exercises
Write a program that inputs marks of ten students in an array and counts the number of students that have marks between 80 and 100. Arrays Exercises
Write a program to enter data into one-dimensional array. Find out the maximum value and its location. Arrays Exercises
Write a program that initializes values in a table and searches for a value from it. If value is found, then it displays the value and its location. Arrays Exercises
Write a program that asks the user for two numbers and shows their division on the screen. If the divisor is zero the program must display an error | Python Programming Programming Exercises
Write a program to initialize values in two tables A and B. Multiply matrix A and B and store results into table C | Multiplication of matrices. Arrays Exercises

Copyright © 2022 MyUstaadG.

Powered by PressBook Blog WordPress theme