Explanation,
Here name is string so as it is defined as character of array 50. The specifier is %s is used to take scanf and value in age is checked with 18 and if it is equal to 18 or greater than this s/he can cast vote and if it is less than 18 and s/he cannot vote.
Exercise: Make a program that can say he is old or yound. [Note if s/he is greater than age 40 than he is old and if he less than 40 then he is young.]
No comments:
Post a Comment
If you have any doubt, let me know...