Home / MCQ Bank / Computer
Computer Miscellaneous On Data Structures Difficulty: Medium

Consider the following iterative solution to find the sum of first n natural numbers: #include<stdio.h> int get_sum(int n) { int sm = 0, i; for(i = 1; i <= n; i++) ________; return sm; } int main() { int n = 10; int ans = get_sum(n); printf("%d",ans); return 0; } Which of the following lines completes the above code?

Select the correct option to test your answer:

More Computer Questions

The internet works by using a protocol called TCP/IP. What is the full form of TCP/IP? which of the following is not a valid Zoom percentage in Excel? What will be the output of the following C++ code? #include <iostream> #include <fstream> using namespace std; int main () { int length; char * buffer; ifstream is; is.open ("sample.txt", ios :: binary ); is.seekg (0, ios :: end); length = is.tellg(); is.seekg (0, ios :: beg); buffer = new char [length]; is.read (buffer, length); is.close(); cout.write (buffer, length); delete[] buffer; return 0; } What is the purpose of the HBase MultiDatacenter Replication feature? What is the administrative distance of OSPF?