You are not logged in.

#1 2015-09-15 05:53:24

husnain
User RankUser RankUser RankUser RankUser RankUser Rank
Administrator
From: Chichawatni,Pakistan
Registered: 2014-10-03
Posts: 8,129
Website

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.

2015-09-15 05:53:24

Advertisement
Ads By Google

Re: Sum Value:



\n

Board footer