Question #8913

write c++ program to multiply the array elements by 2*[A ]= A[i]*2;

Expert's answer

#include "stdafx.h"

#include<iostream>

#include<conio.h>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])

{

int numbers[100];

int n=0;

cout<<"Enter the size of array : ";

cin>>n;

for(int i=0;i<n;i++){

cout<<"Enter element number "<<(i+1)<<": ";

cin>>numbers[i];

}

int multy=1;

for(int i=0;i<n;i++){

multy*=numbers[i]*2;

}

cout<<"

The multiply the array elements is: "<<multy;

getch();

return 0;

}

#include<iostream>

#include<conio.h>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])

{

int numbers[100];

int n=0;

cout<<"Enter the size of array : ";

cin>>n;

for(int i=0;i<n;i++){

cout<<"Enter element number "<<(i+1)<<": ";

cin>>numbers[i];

}

int multy=1;

for(int i=0;i<n;i++){

multy*=numbers[i]*2;

}

cout<<"

The multiply the array elements is: "<<multy;

getch();

return 0;

}

## Comments

## Leave a comment