All coding Solution
13.2K subscribers
185 photos
181 files
36 links
Download Telegram
import java.util.Scanner;

public class Solution {

public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = 4;

Music codewithvirus[] = new Music[n];
for (int i = 0; i < codewithvirus.length; i++) {
int no = sc.nextInt();
sc.nextLine();
String type = sc.nextLine();
int count = sc.nextInt();
sc.nextLine();
double duration = sc.nextDouble();
sc.nextLine();
codewithvirus[i] = new Music(no, type, count, duration);
}

int count1 = sc.nextInt();
sc.nextLine();
double duration1 = sc.nextDouble();

int ans = codewithvirus1(codewithvirus, count1);

if (ans != 0) {
System.out.println(ans);

} else {
System.out.println("No playlist found.");

}

Music temp = null;
for (int i = 0; i < codewithvirus.length; i++) {
for (int j = i + 1; j < codewithvirus.length; j++) {
if (codewithvirus[i].getCount() > codewithvirus[j].getCount()) {
temp = codewithvirus[i];
codewithvirus[i] = codewithvirus[j];
codewithvirus[j] = temp;
}
}
}
int snd = 0;
for (int i = 0; i < codewithvirus.length; i++) {

if (codewithvirus[i].getDuration() > duration1) {
snd++;
System.out.println(codewithvirus[i].getType());

}

}

if (snd == 0) {
System.out.println("No playlist found with mentioned attribute.");

}

}

public static int codewithvirus1(Music[] d, int s) {
int ave = 0;
int n = 0, c = 0;
for (int i = 0; i < d.length; i++) {
if (d[i].getCount() > s) {
c += d[i].getCount();
n++;

}
}
try
{
ave = c / n;
return ave;

}
catch(ArithmeticException e)
{
return 0;
}
}

}

class Music {
private int no;
private String type;
private int count;
private double duration;

public Music(int no, String type, int count, double duration) {
super();
this.no = no;
this.type = type;
this.count = count;
this.duration = duration;
}

public int getNo() {
return no;
}

public void setNo(int no) {
this.no = no;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public int getCount() {
return count;
}

public void setCount(int count) {
this.count = count;
}

public double getDuration() {
return duration;
}

public void setDuration(double duration) {
this.duration = duration;
}

}

TCS IRA exam

@Allcodingsolution
@Allcodingsolution
@Allcodingsolution
@Allcodingsolution
@Allcodingsolution
This is today IRA Java questions solution guys
Just take a reference
Done with both mcqs and sbqs in java



TCS PRA exam

@Allcodingsolution
@Allcodingsolution
@Allcodingsolution
@Allcodingsolution
@Allcodingsolution
n=int(input())
a=list(map(int,input().split()))
e=[i for i in a if i%2==0 ]
b=[i for i in a if i%2!=0 ]
e.extend(b)
print(*e)

Play online game


Python

Accenture exam

Telegram:- @Allcodingsolution
@Allcodingsolution
@Allcodingsolution
@Allcodingsolution
@Allcodingsolution
👍2
C++ language

Write a program to take input of an array of size n and print the second highest number in an array of size n.
Accenture

Telegram:- @Allcodingsolution
@Allcodingsolution
@Allcodingsolution
@Allcodingsolution
@Allcodingsolution