Write output: #include <stdio.h> int sum(int i){ static int total=0; total+=i; return total; } int main(){ int i; for(i=1; i<10; i++){ printf("%d "…

Write output:

#include <stdio.h>
int sum(int i){
    static int total=0;
    total+=i;
    return total;
}
int main(){
    int i;
    for(i=1; i<10; i++){
        printf("%d ", sum(i));
    }
}

From the DESCO Assistant Engineer (CSE) 2016 – Written exam, question 10 of 11.

More from this paper