I believe data carries radio waves
Answer: provided in the explanation section
Explanation:
import java.util.*;
class Mutation {
public static int[] mutateTheArray(int n , int[] a)
{
int []b = new int[n];
for(int i=0;i<n;i++)
{
b[i]=0;
if(((i-1)>=0)&&((i-1)<n))
b[i]+=a[i-1];
if(((i)>=0)&&((i)<n))
b[i]+=a[i];
if(((i+1)>=0)&&((i+1)<n))
b[i]+=a[i+1];
}
return b;
}
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int n= sc.nextInt();
int []a = new int [n];
for(int i=0;i<n;i++)
a[i]=sc.nextInt();
int []b = mutateTheArray(n,a);
for(int i=0;i<n;i++)
System.out.print(b[i]+" ");
}
}
cheers i hope this helped !!
Answer:
In sub procedure or normal program?
Answer:
Explanation:
The Java code provided in the question works as intended. The nextInt() correctly outputs the random value from 1-10 while the nextInt(int min, int max) correctly outputs random values between the int and max parameters. I changed the int/max arguments to 3 and 12 and ran the program to demonstrate that the program is running as intended. Output can be seen in the attached picture below.
n where n is the number of chances user takes to enter a blank number and n>=1.
<u>Explanation:</u>
The loop starts with a universal condition where it is initialized using a true value. Hence the iteration count goes to 1. The user is asked to enter a number after 1st iteration. If number is a blank number, the loop is terminated, else the loop goes on until the users enters a blank number. Hence the iterations depend on the number of chances taken by the user to enter a blank number. Since the user is going to enter a number at least once, the minimum value of n will be 1.