#include <stdio.h>
void oddNumbers(int a, int b){
printf("**oddNumbers function**\n");
printf("Odd numbers between %d and %d are: ", a, b);
if (a < b){
for(int counter = a; counter <= b; counter++){
if(counter % 2 != 0)
{
printf("%d ", counter);
}
}
}
else{
for(int counter = b; counter <= a; counter++){
if(counter % 2 != 0){
printf("%d ", counter);
}
}
}
}
int mathematicalExpression(int a, int b){
printf("**mathematicalExpression function**\n");
char operator;
printf("Please enter an operator (+, -, * or /): ");
//operator = getchar();
scanf(" %c", &operator);
switch(operator)
{
case '+':
return ("%d", a + b);
break;
case '-':
return ("%d", a - b);
break;
case '*':
return("%d", a * b);
break;
case '/':
return("%d", a / b);
break;
default:
printf ("Error! operator is not correct");
}
}
int main(){
int x, y;
printf("Please enter integer x: ");
scanf("%d", &x);
printf("\nPlease enter integer y: ");
scanf("%d", &y);
oddNumbers(x, y);
printf("\n\n");
int result = mathematicalExpression(x, y);
printf("%d", result);
return 0;
}