Good day to all. There is such a problem: when transferring parameters to the Linux console, the error "Segmentation error (memory dump made)" is displayed. Here is the program code (you need to display the required Fibonacci number by index):
int main(int argc, char* argv[]) { cout << "Your value is "; for (int i = 0; argc; i++){ int a = atoi(argv[i]); if (a <= 2) cout << "1"; else{ int x = 1; int y = 0; int ansver; for (int j = 1; j <= a; j++) { ansver = x + y; x = y; y = ansver; } cout << ansver; } } return 0; }