1.

Rewrite the following program after removing any syntactical errors. Underline each correction made. #include<iostream.h>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]; }cout<<S; }

Answer»

#include<iostream.h>

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<<S;

}



Discussion

No Comment Found

Related InterviewSolutions