Advertisement
SumitParakh

Calculate Percentage

Sep 15th, 2012
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. // per.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include<iostream>
  6. using namespace std;
  7. int main()
  8. {
  9.     cout<<32*93/100<<endl;  //It will print 29. (correct but not accurate)
  10.     cout<<32/100*93<<endl;  //It will print 0. (wrong)
  11.  
  12.     cout<<32.0*93/100<<endl;  // correct with accuracy
  13.     cout<<32/100.0*93;  // correct with accuracy
  14.     return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement