Professional Documents
Culture Documents
JumpingStatements
JumpingStatements
void main() {
int main()
{
int i;
for ( i = 1; i <= 7; i++ )
{
if( i == 3) //continue condition
{
continue; //continue statement
}
printf("Value = %d \n",i);
}
}
output
Value = 1
Value = 2
Value = 4
Value = 5
Value = 6
Value = 7
Goto Statement in C
int main() {
int a;
printf("\nEnter a Positive int:");
scanf("%d", & a);
if (a % 2 == 0) //logic of even no
goto Even; //goto statement 1
else
goto Odd; //goto statement 2
Even: // label 1
printf("Number is Even\n");
exit(0);
Odd: //label2
printf("Number is Odd\n");
return 0;
}
Output
Enter a Positive int:4
Number is Even
Reasons to avoid goto statements
int main(void)
{
int current = 2022;
printf("Age: %d", age(current));
return 0;
}
• Arithmetic expressions
• Relational expressions
• Logical expressions
• Conditional expressions
Each type of expression takes certain types of
operands and uses a specific set of operators.
Evaluation of a particular expression produces
a specific value.
• Arithmetic Expressions
• An arithmetic expression is an expression that
consists of operands and arithmetic operators.
An arithmetic expression computes a value of
type int, float or double.
• Example
1+8*2
Relational Expressions