0% found this document useful (0 votes)
15 views7 pages

Part 3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views7 pages

Part 3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

DEBUG WITH SHUBHAM

Accenture Technical Assessment Detailed Overview

Coding Question

https://www.youtube.com/@DebugWithShubham

https://www.linkedin.com/in/debugwithshubham/

https://www.instagram.com/debugwithshubham/

https://topmate.io/debugwithshubham

https://t.me/debugwithshubham


Check Leap Year

Program to check if a given year is leap year

Year = 2000
Year =2024
Year= 2018

If the year is not divisible by 4, it's not a leap year.


If the year is divisible by 4 but not divisible by 100, it's a leap
year.
If the year is divisible by both 100 and 400, it's a leap year.
If the year is divisible by 100 but not divisible by 400, it's not a
leap year.
Java C++

public class Main #include <iostream>


{ using namespace std;
static int ISLP(int y) bool checkYear(int year) { Python
{ if (year % 4 == 0) {
if((y % 400 == 0) || if (year % 100 == 0) {
(y % 100 != 0) && return year % 400 == 0;
(y % 4 == 0))
}
{
return true;
return 1;
}
}
else return false;
{ }
return 0;
} int main() {
} int year = 2000;
public static void main(String[] args) if (checkYear(year)) {
{ cout << "Leap Year" << endl;
int year = 2020; } else {
System.out.println(ISLP(year)); cout << "Not a Leap Year" << endl;
} }
} return 0;
}
Take a array input and print the sum of all even and odd values of the array

Input : arr[] = {1, 2, 3, 4, 5, 6}


Output :Even 9
Odd 12

Input : arr[] = {10, 20, 30, 40, 50, 60, 70}


Output : Even160
Odd 120
C++ JAVA Python
#include <iostream>
import java.io.*
using namespace std;
class EvenOddSum {
void EvenOddSum(int arr[], int n)
{ public static void main(String args[])
int even = 0; {
int odd = 0; int arr[] = { 1, 2, 3, 4, 5, 6 };
for (int i = 0; i < n; i++) { int even = 0, odd = 0;
if (i % 2 == 0) for (int i = 0; i < arr.length; i++) {
even += arr[i]; if (i % 2 == 0)
else
even += arr[i];
odd += arr[i];
} else
odd += arr[i];
cout << "Even << even; }
cout << "\nOdd " << odd;
} System.out.println("Even " + even);
int main() System.out.println("Odd " + odd);
{
}
int arr[] = { 1, 2, 3, 4, 5, 6 };
int n = sizeof(arr) / sizeof(arr[0]); }

EvenOddSum(arr, n);

return 0;
}
1 Print Pattern
23 C++
Java
456 public class Main {
#include <iostream>
using namespace std;

7 8 9 10 public static void main(String[] args) {


int m = 1; int main() {
int m = 1;
for (int i = 0; i < 5; i++) {
PYTHON for (int j = 0; j <= i; j++) {
System.out.print(m + " ");
for (int i = 0; i < 5; i++) {
m++; for (int j = 0; j <= i; j++) {
} cout << m << " ";
System.out.println(); m++;
} }
}
cout << endl;
}
}

return 0;
}

You might also like