CAPGEMINI EXAM SOLUTION GROUP:
https://t.me/capgemini_accenture_code
https://t.me/DMAD_Discussion
@Coding_human
✅ Share post in ur college Whatsapp grps.
https://t.me/capgemini_accenture_code
https://t.me/DMAD_Discussion
@Coding_human
✅ Share post in ur college Whatsapp grps.
import java.util.*;
public class Solution{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
FruitStore[] model=new FruitStore[n];
for(int i=0;i<n;i++) {
model[i]=new FruitStore(sc.nextInt(), sc.nextLine()+sc.nextLine(), sc.nextLine(), sc.nextInt());
}
int arg= sc.nextInt();
if(getFruitByItemNo(model,arg)==null)
System.out.println("No fruits found");
else
System.out.println(getFruitByItemNo(model,arg));
if(getFruitOfMaxPrice(model)==null)
System.out.println("No fruits found");
else {
System.out.println(getFruitOfMaxPrice(model));
}
}
//1st
public static FruitStore getFruitByItemNo(FruitStore[] arr, int itemNo){
FruitStore res=null;
for(FruitStore f:arr) {
if(f.getItemNo()==itemNo)
res=f;
}
return res;
}//end 1st
//2nd
public static FruitStore getFruitOfMaxPrice(FruitStore[] arr){
FruitStore[] res=Arrays.asList(arr).stream().sorted((s1,s2)->{
return s2.getPrice()-s1.getPrice();
}).toArray(size-> new FruitStore[size]);
if(res.length==0)
return null;
return res[0];
}//end 2nd
}//end solution class
class FruitStore{
private int itemNo;
private String name; @Coding_human
private String color;
private int price;
public FruitStore() {
}
public FruitStore(int itemNo, String name, String color, int price) {
super();
this.itemNo = itemNo;
this.name = name;
this.color = color;
this.price = price;
}
public int getItemNo() {
return itemNo;
}
public void setItemNo(int itemNo) {
this.itemNo = itemNo;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String toString() {
return itemNo + "\n" + name + "\n" + color + "\n" + price ;
}
}
FruitStore code
Java
Python
Telegram👇
@Coding_human
@Coding_human
@Coding_human
https://t.me/DMAD_Discussion
https://t.me/DMAD_Discussion
https://t.me/capgemini_accenture_code
⚠️ Share post in ur college and telegram Group's
✅Share with your friends and college group's
public class Solution{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
FruitStore[] model=new FruitStore[n];
for(int i=0;i<n;i++) {
model[i]=new FruitStore(sc.nextInt(), sc.nextLine()+sc.nextLine(), sc.nextLine(), sc.nextInt());
}
int arg= sc.nextInt();
if(getFruitByItemNo(model,arg)==null)
System.out.println("No fruits found");
else
System.out.println(getFruitByItemNo(model,arg));
if(getFruitOfMaxPrice(model)==null)
System.out.println("No fruits found");
else {
System.out.println(getFruitOfMaxPrice(model));
}
}
//1st
public static FruitStore getFruitByItemNo(FruitStore[] arr, int itemNo){
FruitStore res=null;
for(FruitStore f:arr) {
if(f.getItemNo()==itemNo)
res=f;
}
return res;
}//end 1st
//2nd
public static FruitStore getFruitOfMaxPrice(FruitStore[] arr){
FruitStore[] res=Arrays.asList(arr).stream().sorted((s1,s2)->{
return s2.getPrice()-s1.getPrice();
}).toArray(size-> new FruitStore[size]);
if(res.length==0)
return null;
return res[0];
}//end 2nd
}//end solution class
class FruitStore{
private int itemNo;
private String name; @Coding_human
private String color;
private int price;
public FruitStore() {
}
public FruitStore(int itemNo, String name, String color, int price) {
super();
this.itemNo = itemNo;
this.name = name;
this.color = color;
this.price = price;
}
public int getItemNo() {
return itemNo;
}
public void setItemNo(int itemNo) {
this.itemNo = itemNo;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String toString() {
return itemNo + "\n" + name + "\n" + color + "\n" + price ;
}
}
FruitStore code
Java
Python
Telegram👇
@Coding_human
@Coding_human
@Coding_human
https://t.me/DMAD_Discussion
https://t.me/DMAD_Discussion
https://t.me/capgemini_accenture_code
⚠️ Share post in ur college and telegram Group's
✅Share with your friends and college group's
Capgemini, answers
1)d
3-12
2)c
2
3)d
10
5)d
01100
6)a
A b c d
7)a
quque
8)d
Only 2
9)a
5
10)c
10
11)a
48
12)c
13)b
1
14)d
14
15)b @Coding_human
80
17)c
22
18)c
11
19)b
44
20)c
67
✅Telegram :@Coding_human
@Coding_human
1)d
3-12
2)c
2
3)d
10
5)d
01100
6)a
A b c d
7)a
quque
8)d
Only 2
9)a
5
10)c
10
11)a
48
12)c
13)b
1
14)d
14
15)b @Coding_human
80
17)c
22
18)c
11
19)b
44
20)c
67
✅Telegram :@Coding_human
@Coding_human
CAPGEMINI EXAM SOLUTION GROUP:
https://t.me/capgemini_accenture_code
https://t.me/DMAD_Discussion
@Coding_human
✅ Share post in ur college Whatsapp grps.
https://t.me/capgemini_accenture_code
https://t.me/DMAD_Discussion
@Coding_human
✅ Share post in ur college Whatsapp grps.
APPTITUDE TCS 10 AM
1]3
2]7+11√5 / 2
3]3.5miles/hour
4]300
5]150,000
6. 25000
7.4000
8. 9
9. 1225
10. 0
11. 400
12. 27
13) 1000
14) 52.6
15) 4.5
16) 644
17.c
18.25%
19) 3460
TCS Exam Ans
✅Telegram :@Coding_human
https://t.me/DMAD_Discussion
https://t.me/capgemini_accenture_code
1]3
2]7+11√5 / 2
3]3.5miles/hour
4]300
5]150,000
6. 25000
7.4000
8. 9
9. 1225
10. 0
11. 400
12. 27
13) 1000
14) 52.6
15) 4.5
16) 644
17.c
18.25%
19) 3460
TCS Exam Ans
✅Telegram :@Coding_human
https://t.me/DMAD_Discussion
https://t.me/capgemini_accenture_code
TCS Answer 2:30 PM
1.144
2 .325
3.2.2
4.2100
5. 4.555
6.99
7. 510
8. 3.82. @Coding_human
9. 6084
10. 23
11-144
12) 21530 or 22245
13)300000
14) 52,22
15) 4
16) 8
17.200000
18.325.2
19.A
20.0.4
21.12.6
22.19
Telegram @Coding_human
1.144
2 .325
3.2.2
4.2100
5. 4.555
6.99
7. 510
8. 3.82. @Coding_human
9. 6084
10. 23
11-144
12) 21530 or 22245
13)300000
14) 52,22
15) 4
16) 8
17.200000
18.325.2
19.A
20.0.4
21.12.6
22.19
Telegram @Coding_human
Numerical Ability
1)4320
2)720
3)1:11
4)11mins
5)28
6)5f=4h
7)28.67
8)24,12
9)1565
10.12
11 16.5
✅Telegram @Coding_human
1)4320
2)720
3)1:11
4)11mins
5)28
6)5f=4h
7)28.67
8)24,12
9)1565
10.12
11 16.5
✅Telegram @Coding_human
TCS 10Am slot Answer's
1.4536
2.540
3.1:10
4.11Min
5.28
6.5f =4H
7.28.67
8.24,12
9.1565
10.12%
11. 16.5
12. 104
✅Telegram :@Coding_human
1.4536
2.540
3.1:10
4.11Min
5.28
6.5f =4H
7.28.67
8.24,12
9.1565
10.12%
11. 16.5
12. 104
✅Telegram :@Coding_human
public class SmithNumbers {
public static boolean isPrime(int number) {
int loop;
int prime = 1;
for(loop = 2; loop < number; loop++) {
if((number % loop) == 0) {
prime = 0;
}
}
if (prime == 1) {
return true;
} else {
return false;
}
}
public static ArrayList<Integer> primeFactors(int number) {
int sum = 0;
ArrayList al = new ArrayList();
for(int i = 2; i< number; i++) {
while(number % i == 0) {
System.out.println(i+" ");
al.add(i);
number = number/i;
}
}
if(number >2) {
System.out.println(number);
al.add(number);
}
return al;
}
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter a number :");
int num = sc.nextInt();
int sum = 0;
@Coding_human
if(isPrime(num)) {
System.out.println("Given number is not smith number ");
} else {
ArrayList<Integer> arrayList = primeFactors(num);
System.out.println("Prime factors of the given number are"+arrayList);
Iterator it = arrayList.iterator();
while(it.hasNext()) {
int n = (int) it.next();
System.out.println(n);
while(n!=0) {
sum = sum+n%10;
n = n/10;
}
}
int temp = 0;
while(num != 0) {
temp = temp + num%10;
num = num/10;
}
System.out.println("sum of the digits of the numbers of the prime factorization: "+sum);
System.out.println("Sum of digits in the given number: "+temp);
if(temp==sum) {
System.out.println("Given number is a smith number");
} else {
System.out.println("Given number is not smith number ");
}
}
}
}
Java
Smith number Code
✅Telegram :@Coding_human
public static boolean isPrime(int number) {
int loop;
int prime = 1;
for(loop = 2; loop < number; loop++) {
if((number % loop) == 0) {
prime = 0;
}
}
if (prime == 1) {
return true;
} else {
return false;
}
}
public static ArrayList<Integer> primeFactors(int number) {
int sum = 0;
ArrayList al = new ArrayList();
for(int i = 2; i< number; i++) {
while(number % i == 0) {
System.out.println(i+" ");
al.add(i);
number = number/i;
}
}
if(number >2) {
System.out.println(number);
al.add(number);
}
return al;
}
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter a number :");
int num = sc.nextInt();
int sum = 0;
@Coding_human
if(isPrime(num)) {
System.out.println("Given number is not smith number ");
} else {
ArrayList<Integer> arrayList = primeFactors(num);
System.out.println("Prime factors of the given number are"+arrayList);
Iterator it = arrayList.iterator();
while(it.hasNext()) {
int n = (int) it.next();
System.out.println(n);
while(n!=0) {
sum = sum+n%10;
n = n/10;
}
}
int temp = 0;
while(num != 0) {
temp = temp + num%10;
num = num/10;
}
System.out.println("sum of the digits of the numbers of the prime factorization: "+sum);
System.out.println("Sum of digits in the given number: "+temp);
if(temp==sum) {
System.out.println("Given number is a smith number");
} else {
System.out.println("Given number is not smith number ");
}
}
}
}
Java
Smith number Code
✅Telegram :@Coding_human
Please open Telegram to view this post
VIEW IN TELEGRAM
⭐️Technical and HR interviews material
https://bit.ly/3F98IDJ
Share our channel with your college friends : https://t.me/Coding_human
https://bit.ly/3F98IDJ
Share our channel with your college friends : https://t.me/Coding_human
Please open Telegram to view this post
VIEW IN TELEGRAM
ACCENTURE EXAM ALL SLOTS SOLUTION GROUP:
@Coding_human
https://t.me/accenture_all_slots_exam_code
✅ Share post in ur college Whatsapp grps.
@Coding_human
https://t.me/accenture_all_slots_exam_code
✅ Share post in ur college Whatsapp grps.