Answers for "how to input n space separated integers in c"

C
0

how to read space separated words in c

scanf("%[^n]%*c", ref_string);
Posted by: Guest on November-13-2020
0

input n space separated integers in c++

int main() {
int sum = 0;
cout << "enter number" << endl;
int i = 0;
while (true) {
    cin >> i;
    sum += i;
    //cout << i << endl;
    if (cin.peek() == 'n') {
        break;
    }
    
}

cout << "result: " << sum << endl;
return 0;
}
Posted by: Guest on June-11-2021
0

how to input n space separated integers in c

int main() {
    int i, n;
    scanf("%d", &n);
    int arr[n];
    for(i=0;i<n;i++)
        scanf("%d", &arr[i]);
}
Posted by: Guest on January-05-2022

Code answers related to "how to input n space separated integers in c"

Code answers related to "C"

Browse Popular Code Answers by Language