i am trying to short the code but now this is not working. i need to short the code for it's run time.Is there nayone who can told me the error of this code and solution of this code.
# include <stdio.h>
int main( )
{
int bonus, cy, yoj, yos ;
printf ( "Enter current year and year of joining " ) ;
scanf ( "%d %d", &cy, &yoj ) ;
yos = cy - yoj ;
( yos > 3 )? bonus=100:printf ( "Bonus = Rs. %d\n", bonus );
return 0 ;
}
CodePudding user response:
It does not work like this.
As you do not mention what should happen if yos < 3
I decided to set bonus to 0
.
printf ( "Bonus = Rs. %d\n", bonus = ( yos > 3 ) ? 2500 : 0 );