Write a C++ program that divides two float variables and find the remainder by using explicit casting.

 


#include<iostream>

using namespace std;

int main()

{

float a,b;

int c;

a = 10.3;

b = 5.2;

c = (int)a % (int)b;

cout<<"Result is "<<c;

}

OUTPUT

Result is 0

1 comment: