log in
About and Contact
© 2020 DOUBTCOOL
Python Code:-
ec=0 oc=0 n=int(input()) a=list(map(int,input().split())) for i in range(n): if(a[i]%2==0): ec+=1 else: oc+=1 if(ec>=oc and sum(a)!=0): print("READY FOR BATTLE") else: print("NOT READY")
type this code for c language plzz
48. Kattapa, as you all know was one of the greatest warriors of his time. The kingdom of Maahishmati had never lost a battle under him (as army-chief), and the reason for that was their really powerful army, also called as Mahasena. Kattapa was known to be a very superstitious person. He believed that a soldier is "lucky" if the soldier is holding an even number of weapons, and "unlucky" otherwise. He considered the army as "READY FOR BATTLE" if the count of "lucky" soldiers is strictly greater than the count of "unlucky" soldiers, and "NOT READY" otherwise. Given the number of weapons each soldier is holding, your task is to determine whether the army formed by all these soldiers is "READY FOR BATTLE" or "NOT READY". Write an algorithm for the above. Draw the flowchart and write the pseudo code for the same. CO1 K3