You are not logged in.
- Index
- » Quiz Questions
- » Sum Value:
- 0
Pages:: 1
#1 2015-09-15 05:53:24
Sum Value:
C Programming Quizzes C Language Control Structures
Directions:
Consider the following program fragment:
for(c=1, sum=0; c <= 10; c++)
{
scanf("%d", &x);
if( x < 0 ) continue;
sum += x;
}
Question:
What would be the value of sum for the input 1, -1, 2, -2, 3, -3, 4, -4, 5, -5
Option A):
15
Option B):
12
Option C):
131
Option D):
14
Correct Answer is Option A):
15
You cannot discover the new oceans unless you have the courage to lose the sight of the shore.
Offline
2015-09-15 05:53:24
- Advertisement
- Ads By Google
Re: Sum Value:
\n
Pages:: 1