comingsoon
Replies to this thread:
More by comingsoon
What people are reading
Visitor is reading nepali model wanted,,,,,,,,,,,,,,,,,,,,
Subscribers
Please log in to subscribe to comingsoon's postings.
:: Subscribe
|
|
[VIEWED 10235
TIMES]
|
SAVE! for ease of future access.
|
|
|
|
comingsoon
Please log in to subscribe to comingsoon's postings.
Posted on 09-26-13 11:47
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
| |
Write a function that receives an integer, b, that represents a number of bytes. If 1 ≤ b ≤ 8, the function will return the largest positive value that an unsigned int of b bytes can represent. If b is not in the appropriate range, the function should return -1. The function declaration is
long largest(int);
Assume that this function will be executed on a 64-bit operating system. You can use the pow() function which returns a double with the value b^e when called with
pow(b, e).
Can somebody help?
|
| |
|
|
|
|
helpjava11
Please log in to subscribe to helpjava11's postings.
Posted on 09-27-13 12:48
PM [Snapshot: 157]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
| |
Basically you need to understand the logic for this problem.
1 byte = 8 bit ( Are sure you dont mean 8 bits, bit and byte are different)
You can find the largest possible integer value possible with any bit with this forlula: (2^n-1)
In your case Total integer = 2^64 = 18446744073709551616
That means you can represent 0 to 18446744073709551615 with 8 bytes.
#include<math.h> main() { double b = 64; b = pow(2,b); }
This is not a complete code, try for yourself. If you still have doubt contact me
|
| |
|
|
Please Log in! to be able to reply! If you don't have a login, please register here.
YOU CAN ALSO
IN ORDER TO POST!
Within last 90 days
| Recommended Popular Threads |
Controvertial Threads |
| ए १ पनि पुगेनछ ? |
| Democrat wants to run election like in India. Chaos and Confusing to voters. |
| नोबेल शान्ति पुरस्कार र अशान्त राष्ट्रपतिको बालहठ |
| 200 denaturalization cases per month to the Department of Justice for the 2026 fiscal year. |
| नेपाली वालमार्ट चोर |
| मिरो प्रेडिक्शन जन्मेर एमेरिकामा आखा खो ल न पायेका नागरिकता बारे |
| मानसिक सन्तुलन, एक कहालीलाग्दो घटना सिक्नुपर्ने कुराहरु |
| Breaking News: Ninth Circuit Rejects Government Bid to Undo Nepal TPS Order, Leaves Protections in Place |
| Why Oli must go for the UML to survive? |
| Funny when Nepalis talk about Epstein and injustice |
| Sukulgunda 2.0 / www.sukulgunda.com |
| Why Prachanda seems to be the smartest of them all? |
| When will Nepali women be equal? |
| बालेंन मेयर बाट प्रधान मन्त्रि हुने भो ? |
| When will the culture of impunity end? |
| बालेंन आए पछि आशाका किरण देखिन थालेका छन् !! |
| Can we really get rid of Nepotism in the government? |
| आरको नेपालीले बेजत गर्यो फेरी अरविंग टेक्सासमा बुढ़ाहरू लाई स्कॉम गरेर |
| How many ministries do we really need? |
| Deepak Bhatta could help bring down the three stooges |
|
|
NOTE: The opinions
here represent the opinions of the individual posters, and not of Sajha.com.
It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address
if you want any posting to be considered for deletion. Your request will be
handled on a one to one basis. Sajha.com is a service please don't abuse it.
- Thanks.
|