Afghanistan has surrounded by attackers. A truck enters the city. The driver claims the load is food and medicine from Pakistanis. Yasir is one of the soldier in Afghanistan. He doubts about the truck, maybe it's from the siege. He knows that a tag is valid if the sum of every two consecutive digits of it is even and its letter is not a vowel. If the tag is invalid then Yasir need to arrest the driver of the truck with invalid tab. If it is valid the truck is allowed inside the country.Can you help yasir in determine if he need to arrest or allow the truck?
#include <stdio.h>
int main()
{int n=0,c=0;
char tag[9];
scanf("%s",tag);
while(n<8){
if(tag[n+1]=='-')
n+=2;
else if((tag[n]+tag[n+1])%2==0)
c++;
n++;}
if(c>=4)printf("Allowed");
else printf("Arrest");
return 0;
}
Comments
Post a Comment