-
Code unsigned long long div2(unsigned long long a) { return a * 0.5; }
Test Cases // TODO: Replace examples and use TDD by writing your own tests Describe(d2) { It(under10) { Assert::That(div2(10), Equals(5)); Assert::That(div2(0), Equals(0)); Assert::That(div2(3), Equals(1)); } It(huge_numbers) { Assert::That(div2(65536), Equals(32768)); Assert::That(div2(6553665535), Equals(3276832767)); Assert::That(div2(1234567890), Equals(617283945)); } };
Output:
-
Code - unsigned long long div2(unsigned long long a) {
return a >>1;- return a * 0.5;
- }
- All
- {{group.name}} ({{group.count}})
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}