A grandparent, parent and child problem
A grandparent, parent and child problem
Here is a possible solution to the "Grandparent, Parent and Child" problem in Objective-C:
The problem is as follows:
Here is a possible solution in Objective-C:
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
// Initial amount of money the grandparent has
int grandparentMoney = 100;
// Grandparent gives half to parent
int parentMoney = grandparentMoney / 2;
grandparentMoney = grandparentMoney - parentMoney;
// Parent gives half to child
int childMoney = parentMoney / 2;
parentMoney = parentMoney - childMoney;
// Child spen...
middle
Gợi ý câu hỏi phỏng vấn
Chưa có bình luận nào