answersLogoWhite

0

#include<stdio.h>

#include<conio.h>

void main()

{ int n;

printf("please enter number \n");

scanf("%d",n);

switch(n%2)

{

case 0 : printf("even");

break;

case 1 :

case -1 :

printf("odd");

}

getch();

}

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Math & Arithmetic

What do the numbers on a tact switch mean?

The numbers on a tact switch can mean a variety of things. Typically, the number will be a model or part number. Depending on where the number is, that will tell what the number is for. You can call the manufacturer and ask them specifically for your switch.


What is general form of declaring a switch in C?

In C, a switch statement is used to execute one block of code among multiple choices based on the value of a variable. The general form of a switch statement is as follows: switch (expression) { case constant1: // Code to execute for constant1 break; case constant2: // Code to execute for constant2 break; // Additional cases... default: // Code to execute if no cases match } The break statement is used to exit the switch after a case is executed, and the default case is optional, handling any values not matched by the specified cases.


How many arithmetic statement in c?

Only one: expression. Yes, in C expression is one of the statements. Some other statements are: if, do, goto, while, for, switch, break, continue, return, NULL-statement, compound-statement.


What is the advantage of having the binary number system to represent data inside the computer instead of the decimal number system?

They use the binary sysem because the number 1 means the switch is turned on and the number 0 means the switch is off. There is no way to use the decimal number system.


What is the highest hexidecimal number from a 10-position dip switch?

A 10-position dip switch can represent binary values ranging from 0000000000 (0 in decimal) to 1111111111 (which is 1023 in decimal). The highest hexadecimal number from this binary representation is obtained by converting 1111111111 to hexadecimal, which results in 3FF. Therefore, the highest hexadecimal number from a 10-position dip switch is 3FF.

Related Questions

What is case in java?

Case is used to label each branch in the switch statement in Java Program


Can a continue statement be used in a switch statement?

If you have a loop in your switch statement or around your switch statement, you can use the continue statement in that. You cannot use a continue statement outside of a loop (do, for, or while).


What is the difference between 'switch' statement and 'if' statement?

we can use switch statement in multiple time but in if statement we can not use multiple time


What is the deffernce of the switch statement and the if statement in c plus plus?

If statement is single selection statement,whereas the switch statement is multiple selective.


What does default mean in switch statement?

Default clause in switch statement used to indicate that the desired option is not available with the switch case statement. it is similar to else statement of if statement which is used when the condition does not satisfy.


What is output if we don't write break statement in switch-case in c sharp?

This question cannot be generally answered, the output depends on the actual program.


How does the case statement work in c?

prog1: #include&lt;stdio.h&gt; int main() { switch(1) { int i=0; case 1:printf("%d",i); } getchar(); return 0; } Output: garbage value. prog2: #include&lt;stdio.h&gt; int main() { switch(1) { printf("Inside Switch"); case 1:printf("Case 1\n"); } printf("Outside Switch"); getchar(); return 0; } Output: Case 1 Outside Switch. The statements before a case labelled statement seem unreachable according to program 2 but then why don't i get an error for an undeclared variable i in the first program (only a warning). Would be really helpful if someone could explain in detail that how the switch statement is treated internally.


What is the use of switch statement in java?

In java, a switch statement is used to simplify a long list of 'if' statements. A switch statement takes the form of:switch (variableName){case condition1; command1;case condition2; command2;...}


Why you use if and else statement in c language program?

There is no "elseif" statement in C. You can only use "else" and "if" separately. This is a good reason for switch/case/break.


Explain with suitable example how switch statement is differ from if statement?

www.assignmentsclub.com


How do you break a loop in a switch case statement?

using break; statement


How do you program vlans on a switch?

how to prgram vlans on a switch