Write a program using conditional compilation directives to round off the number 56 to nearest fifties.Expected Output: 50
where is mistake?
#include <iostream>
using namespace std;
#define R 50
int main()
{
int Div;
Div = R % 50;
cout<<"Div:: "<<Div;
printf("\n");
#if(Div<=24)
{
int Q;
printf("Rounding down\n");
Q =(int(R /50))*50;
printf("%d",Q);
}
#else
{
int Q;
printf("Rounding UP\n");
Q =(int(R/50)+1)*50;
printf("%d",Q);
}
#endif
}
Aucun commentaire:
Enregistrer un commentaire