Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

This is the code I wrote in C, but it isn't printing the answer. What did I do wrong #include stdio.

This is the code I wrote in C, but it isn't printing the answer. What did I do wrong

#include <stdio.h>

int main(int argc, const char * argv[]) {

  /*Create a script that will find the sum of all the multiples of 3 between 1 and 1000 by using For Loop. Pseudo code required*/

  /*Redo Problem 2 with While Loop and Do While Loop (Use Break at least once). */

  /*Initialization expression*/

  int i;

  int sum;

  while(i)

  {

    if(i>1000){

      break;

    }

    if (i%3==0){

      sum=sum+i;

      i++;

    }

    printf("Using while loop the sum was: %dn", sum);

  }

  return 0;

  }

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question