# Help me in solving PRACTICEPERF problem

### My code

``````# cook your dish here
p1,p2,p3,p4=map(int,input().split(' '))

``````

Problem Link: PRACTICEPERF Problem - CodeChef

include <stdio.h>

int main(void) {
int a,i,count=0;
for(i=0;i<4;i++)
scanf(“%d”,&a[i]);
for(i=0;i<4;i++){
if(a[i]<10)
count++;}
printf(“%d\n”,4-count);
return 0;
}

@riyasharmaaa16
the approach is to take a variable and increase its value by 1 each time you find a number greater than or equal to 10 in the array.
i have pasted my correct code below

hope this helps

include
using namespace std;

int main() {
int a;int sum=0;
for(int i=0;i<4;i++)
{
cin>>a[i];
if(a[i]>=10)
{
sum++;
}
}
cout<<sum<<endl;

``````return 0;
``````

}

``````/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
int count=0;
int arr[]=new int;
for(int i=0;i<4;i++){
arr[i]=sc.nextInt();
if(arr[i]>=10){
count++;
}
}
System.out.println(count);
}
}

``````

Since your question had Python code in it, I have answered in Python. The trick is to add the 4 variables in a list in Python which is the Python equivalent of an array. Then iterate through that list to check which week is greater than or equal to 10. For those weeks increment the counter by 1. Print the counter at the end of the program.

``````weeks = list(map(int, input().split()))

count = 0

for week in weeks:
if week >= 10:
count += 1

print(count)
``````

Here’s the solution in the submissions list: CodeChef: Practical coding for everyone

``````type or paste code here
Scanner sc=new Scanner(System.in);
int value=0;
int a[]=new int;
for(int i=0;i<4;i++){
a[i]=sc.nextInt();
if(a[i]>=10){
value++;
}
}
System.out.println(value);

``````