Hi, This is a recent bitwise contest problem. Problem is posted below.
scanf("%d",&n); while(n--) { scanf(" %lld",&no); scanf(" %d",&max); for(i=1;i<no;i++) { scanf(" %d",&num); if(max < num) max= num; } printf("%lld\n",max); } I got wrong answer . Why is it wrong ? http://www.bitwise.iitkgp.ernet.in/index.php?q=status&p=problems&pset=2 Problem Statement Find the largest element in a list of numbers Input: A single positive integer on the first line gives the number of test cases. Each test case has a number N on the first line giving the number of numbers in the list. The next line has N numbers. Output For each test case, give a single integer specifying the largest number in the list for that test case. Sample input: 3 4 5 6 2 3 8 1 0 -2 5 8 17 102 15 5 -21 -58 -3 -1 -8 Sample Output: 6 102 -1