1. Write a program statement that will do the following to array MyArray shown below:
int MyArray[10];
for(i=0;i<=9;i++)
MyArray[i]=i*2;
i. Print all elements of array MyArray.
ii. Print all element of array MyArray in reverse.
iii. Print the first element.
iv. Replace the value of third elements with 7.
v. Copy the value of fifth elements into the first one.
vi. Find the sum of the first five elements
vii. Display all even-numbered elements on one line.
2 Write a program that reads ten integers and displays them in the reverse of the order in which they were read.. (Hint: Use loop with an array).
#include
#include
using namespace std;
int main(int argc, char *argv[])
{
// TODO, add your application code
system("PAUSE");
return EXIT_SUCCESS;
}
No comments:
Post a Comment