#include<stdio.h>
int main()
{
int sum=0,n,r,count=0,numcount=0,m,r1,r2,r3,r4,r5,r6;
while(count<10)
{
printf("Enter pin code\n");
scanf("%d",&n);
m=n;
r1=n%10;
n/=10;
r2=n%10;
n/=10;
r3=n%10;
n/=10;
r4=n%10;
n/=10;
r5=n%10;
n/=10;
r6=n%10;
while(m!=0)
{
numcount++;
r=m%10;
sum+=r;
m/=10;
}
if(numcount!=6||sum<30||r1%2!=0||r2%2!=0||r3%2!=0||r4%2!=0||r5%2!=0||r6%2!=0)
{
printf("Invalid code\n");
count++;
}
else
{
printf("code is valid you can proceed\n");
break;
}
}
if(count>10)
{
printf("your out of chances\n");
}
return 0;
}