c++ - Data type to store more than 20 digits of value -


‪#‎include‬ <iostream> #include <conio.h> using namespace std; int main() {     double n,m,a, count=0;     cin>>n>>m>>a;     double length=n;     while(m>0)     {         while(n>0)         {             count=count+1;             n=n-a;         }         m=m-a;         n=length;     }     cout<<count;     getch();     return 0; } 

sample input

6 6 4 

output

4 (working fine) 

sample input

1000000000 1000000000 13 

output

___ no output 

means working fine small range of "count" value. if value exceeds limit not printing anything. have tried range of values. please me

the reason getting no output sample input of 1000000000 1000000000 13 because takes far long.

the inner loop runs 76923077 times, , outer loop runs 76923077 times. means inner code count=count+1 running 5.91 x 10^15 times. if inner code run in picosecond (it can't), take more 98 hours complete.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -