what is the different between if-else and switch statment
(other than syntax)
Answer Posted / bakhtiar khan wazir
IF Statement: Checks the value of data is less than or greater than. (in ranges).
example: can tell wether an input age is more than 18 and less than 60.
Switch Case: Checks the value of data that is prespecified. only equal to.
example: Can only generate output if the value matches. When the age is 18 or when the age is 60 . No comarison of data based on greater than or smaller than. Compares data based on equality.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is switch in c?
Explain how do you sort filenames in a directory?
Explain about the constants which help in debugging?
What is the condition that is applied with ?: Operator?
Explain what is the difference between a free-standing and a hosted environment?
Is fortran still used today?
write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare. You will then tabulate this information in another file.
int i=10; printf("%d %d %d", i, i=20, i);
A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM
to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?
What is pointer and structure in c?
Where can I get an ansi-compatible lint?
What does s c mean on snapchat?
What is #include stdio h and #include conio h?
main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none