Hello Sir,
I have an assignment to do, my question is:--
Given the set of integers, find the sum of all positive integers in it.
Input
t – number of test cases [t < 1000]
On each of next t lines given a integer N [-1000 <= N <= 1000]
Output
One integer equals to sum of all positive integers.
Source code of program should be less than 65 characters.
white space and tabs are not counted.
my code :-
x="%d";main(b,a,t)
{
for(scanf(x,&t);t;t--)
for(scanf(x,&a);a>0;a=0)b+=a; printf(x,b-1);
return 0;
}
source code is of 93 characters.
I have reduced my code upto this from 122 characters , now I am unable to reduce it further, what should I do.
I have also used atoi(gets(&t)) instead of scanf(x,&t); but time limit exceeds.
return 0 is necessary in program otherwise it is giving NZEC runtime error.
I don't know what to do more to reduce my sorce code.
Help me Sir.