Untitled

mail@pastecode.io avatar
unknown
csharp
7 months ago
465 B
0
Indexable
Never
#include <stdio.h>

int main() {
    int number1, number2, sum;
    
    printf("Enter two odd integers: ");
    scanf("%d %d", &number1, &number2);

    // Check if the numbers are odd
    if (number1 % 2 == 0 || number2 % 2 == 0) {
        printf("Error: Both numbers must be odd.\n");
        return 1; // Return an error code
    }

    // Calculate the sum
    sum = number1 + number2;
    
    printf("%d + %d = %d\n", number1, number2, sum);
    return 0;
}
Leave a Comment