-
For Loop코딩 테스트/HackerRank 2021. 9. 16. 23:44
https://www.hackerrank.com/challenges/c-tutorial-for-loop/problem For Loop | HackerRank Learn how to use for loop and print the output as per the given conditions www.hackerrank.com #include #include using namespace std; string numbers[10] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; int main() { // Complete the code. int num, sum; cin >> num >> sum; for (i..
-
Functions코딩 테스트/HackerRank 2021. 9. 15. 21:57
https://www.hackerrank.com/challenges/c-tutorial-functions/problem Functions | HackerRank Learn how to write functions in C++. Create a function to find the maximum of the four numbers. www.hackerrank.com #include #include using namespace std; /* Add `int max_of_four(int a, int b, int c, int d)` here. */ int max_of_four(int a, int b, int c, int d) { int temp1, temp2; if (a > b) temp1 = a; else t..
-
Pointer코딩 테스트/HackerRank 2021. 9. 14. 22:35
https://www.hackerrank.com/challenges/c-tutorial-pointer/problem Pointer | HackerRank Learn how to declare pointers and use them. www.hackerrank.com #include #include void update(int *a,int *b) { // Complete this function int tempSum, tempAbs; tempSum = *a + *b; tempAbs = abs(*a - *b); *a = tempSum; *b = tempAbs; } int main() { int a, b; int *pa = &a, *pb = &b; scanf("%d %d", &a, &b); update(pa,..
-
Print the Elements of a Linked List코딩 테스트/HackerRank 2021. 9. 13. 23:30
https://www.hackerrank.com/challenges/print-the-elements-of-a-linked-list/problem Print the Elements of a Linked List | HackerRank Get started with Linked Lists! www.hackerrank.com // ... void printLinkedList(SinglyLinkedListNode* head) { while(head != nullptr) { cout data next; } } // ...