As you are a Software engineer,
Remove this bug from the code.
************************************************************************
#include < stdio.h >
#define LAST 10
int main()
{
int i, sum = 0;
#define LAST 10
int main()
{
int i, sum = 0;
for ( i = 1; i < = LAST; i++ )
{
sum += i;
}
/*-for-*/
printf("sum = %d\n", sum);
return 0;
}
Solution
************************************************************************
And the developer fixes it this way >>
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
::
#include <stdio.h>
#define LAST 10
#define LAST 10
int main()
{
int i, sum = 0;
/*
{
int i, sum = 0;
/*
*/
for ( i = 1; i < = LAST; i++ )
{
sum += i;
}
/*-for-*/
printf("sum = %d\n", sum);
return 0;
}
for ( i = 1; i < = LAST; i++ )
{
sum += i;
}
/*-for-*/
printf("sum = %d\n", sum);
return 0;
}
0 comments:
Post a Comment