Last active
July 18, 2019 18:29
-
-
Save sachinsaxena25/e968715e8ce2b90b1ccec24e96848b21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main(void){ | |
int current_year = 0; | |
int year_of_joining = 0; | |
float year_of_services = 0.0f; | |
float bonus = 0.0f; | |
printf("please enter current year:"); | |
scanf("%d", ¤t_year); | |
printf("please enter year of joining:"); | |
scanf("%d", &year_of_joining); | |
year_of_services = current_year = year_of_joining; | |
if(year_of_services > 3) | |
{ | |
bonus = 2500.0f; | |
printf("Calculated Bonus Rs: %.2f\n", bonus); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
float
, think what should type of value you want to store.current_year
andyear_of_joining
variables can beint
simply.year_of_services = current_year - year_of_joining;