C | Storage Classes and Type Qualifiers | Question 18
Output of following program
s = 0;
s = s + n;
i = 10, x;
(i > 0)
x = fun(i);
Explanation: Since s is static, different values of i are added to it one by one.
So final value of s is
s = i + (i-1) + (i-2) + … 3 + 2 + 1.
The value of s is i*(i+1)/2. For i = 10, s is 55.
Quiz of this Question
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!