MENU
Question -

Rewrite the following program after removing any syntactical errors. Underline each correction made.

#include
void main()
int A[10];
A = [3, 2, 5, 4, 7, 9, 10]; 
for(p = 0; p <= 6; p++)
if(A[p]%2=0)
int S = S + A[p]];
}



Answer -

#include 
void main()
int A[10] = {3, 2, 5, 4, 7, 9, 10}; 
int S = 0, p;
for(p = 0; p <= 6; p++)
if(A[p]%2 == 0)
S = S + A[p]; 
cout<
}

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
×