Computer Science, asked by Manikbhatia6738, 9 months ago

Write a program to read and write 10 arrays

Answers

Answered by Anonymous
0

Answer:

#include <stdio.h>

int main()

{

int i,arr[10],sum=0;

printf("Enter 10 elements:");

for(i=0;i<10;++i)

scanf("%d",&arr[i]);

for(i=0;i<10;++i)

sum=sum+arr[i];

printf("Sum of numbers is:%d",sum);

return 0;

}

In C++

#include <iostream>

using namespace std;

int main()

{

int i,arr[10],sum=0;

cout<<"Enter 10 elements:";

for(i=0;i<10;++i)

cin>>arr[i];

for(i=0;i<10;++i)

sum=sum+arr[i];

cout<<"Sum of numbers is:"<<sum;

return 0;

}

#include <stdio.h>

int main() {

int a[1000],i,n;

printf("Enter size of array: "); scanf("%d",&n);

printf("Enter %d elements in the array : ", n);

Similar questions