Write a C++ program that accepts three numbers from the user (All are integers):
Such as:
Enter the first mark: 3
Enter the second mark: 25
Enter the third mark: 23
The program should find and print the average of the odd numbers greater than 5 and less than 100.
this is my code :
PHP Code:
#include <vcl.h>
#include "MT262io.h"// this is the library for the input and output//
#pragma hdrstop
//---------------------------------------------------------------------------
#pragma argsused
int main(int argc, char* argv[])
{
int firstNum;
int secondNum;
int thirdNum;
int average;
firstNum=ReadIntPr(" enter the first number");
secondNum=ReadIntPr(" enter the second number");
thirdNum=ReadIntPr(" enter the third number");
average=(firstNum+secondNum+thirdNum/3);
while((average >5) && (average <100)) {
if(firstNum % 2 != 0)&&(secondNum % 2 != 0)&& (thirdNum % 2 != 0) {
WriteIntPr("the average of the odd numbers is"+average);
}
getchar();
return 0;
}
//---------------------------------------------------------------------------
where are my mistakes and how can i fix them ?