Computer Science, asked by bishtpreeti9012, 4 months ago

write a program to accept 20 different numbers in a single dimensional array display the sum of all the numbers which are divisible by either 3 or 5

Answers

Answered by adityarana72
0

Explanation:

in which language

bro

please say the language

Answered by rswathivel
0

Answer:

import java.util.*;

public class Sum

{

public static void main( String args[])

{

Scanner sc= new Scanner(System.in);

int a[]= new int[20];

int i, S=0;

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

{

a[i]=sc.nextInt();

}

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

{

if(a[i]%3==0||a[i]%5==0)

{

S+=a[i];

}

}

System.out.println("Sum of 20 elements:"+S);

}

}

Explanation:

please mark this answer as brainliest answer

Similar questions