(A) Write a C++ program to sum all odd integers divisible by 3 in the range (X,Y). Integers X and Y are to be input by the user. Your program should validate that X is smaller than Y, and output error message if not.

Note: Use whileloop for the validation and forloop to calculate the sum.

Sample input/output

Enter the value of x and y : 23 10

Error message x should be smaller than y

Enter the value of x an y : 13 70

Sum of odd integers divisible by 3 = 420

Please post what you have done already so we can advise you about it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.