first question java code this code works? class HelloWorld { public static void main(String[] args) { int a[]={3,6,8,5,4}; int avg=0; int c=0; for(int i=0;i
for 1st ques : def average_of_even_indices(arr): total = 0 count = 0 for i in range(len(arr)): if i % 2 == 0 : total += arr[i] count += 1 if count == 0: return 0 return total/count arr = list(map(int, input("Enter array: ").split())) result = average_of_even_indices(arr) print(result) for 2nd ques : def find_dividend_index(A, D, Q, R, N): dividend = D * Q + R for i in range(N): if A[i] == dividend: return i return -1 A = list(map(int, input("Enter array: ").split())) D = int(input("Enter Divisor: ") Q = int(input("Enter Quotient: ") R = int(input("Enter Remainder: ") N = int(input("Enter N: ") result = find_dividend_index(A, D, Q, R, N) print(result)
bro
tommorrow i am having accenture drive
please upload the answer once you get
arr = [3,6,8,5,4]
count = 0
sum = 0
for i in range(len(arr)):
if(i%2 == 0):
sum += arr[i]
count +=1
avg = sum/count;
print(avg)
second question
class HelloWorld {
public static void main(String[] args) {
int div=8,rem=1,quo=7;
int ans=div*quo+rem;
System.out.println(ans)
}
}
l=list(map(int,input().split()))
m=[]
for i in range(len(l)):
if i%2==0:
m.append(l[i])
else:
pass
print(sum(m)//len(m))
bro
tomorrow i am having accenture assessment please upload the answer for coding once you get
avg
public class Main
{
public static void main(String[] args) {
int arr[]={3,6,8,5,4};
int res=0;
int c=0;
for(int i=0;i
bro , I have doubts do you require Google sponsorship work Authorization for you to work in country what we need to mark either YES or NO
No
first question java code
this code works?
class HelloWorld {
public static void main(String[] args) {
int a[]={3,6,8,5,4};
int avg=0;
int c=0;
for(int i=0;i
I need Cognizant previous questions pdf..
Dm me - Insta
Bro code for min perfect square one
do you have code? if you have send.
python code brother
arr = [3,6,8,5,4]
count = 0
sum = 0
for i in range(len(arr)):
if(i%2 == 0):
sum += arr[i]
count +=1
avg = sum/count;
print(avg)
for 1st ques :
def average_of_even_indices(arr):
total = 0
count = 0
for i in range(len(arr)):
if i % 2 == 0 :
total += arr[i]
count += 1
if count == 0:
return 0
return total/count
arr = list(map(int, input("Enter array: ").split()))
result = average_of_even_indices(arr)
print(result)
for 2nd ques :
def find_dividend_index(A, D, Q, R, N):
dividend = D * Q + R
for i in range(N):
if A[i] == dividend:
return i
return -1
A = list(map(int, input("Enter array: ").split()))
D = int(input("Enter Divisor: ")
Q = int(input("Enter Quotient: ")
R = int(input("Enter Remainder: ")
N = int(input("Enter N: ")
result = find_dividend_index(A, D, Q, R, N)
print(result)