Advertisement
ppupil2

Q03-PRF192-PE-31.03

Mar 31st, 2020
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <math.h>
  5.  
  6.  
  7. int main() {
  8.   system("cls");
  9.   //INPUT - @STUDENT:ADD YOUR CODE FOR INPUT HERE:
  10.     int a, b;
  11.     scanf("%d",&a);
  12.     scanf("%d",&b);
  13.  
  14.  
  15.  
  16.  
  17.   // Fixed Do not edit anything here.
  18.   printf("\nOUTPUT:\n");
  19.   //@STUDENT: WRITE YOUR OUTPUT HERE:
  20.     int prod = 0;
  21.     for(int i=a; i<=b; i++) //@STUDENT: EDIT THIS LINE TO HAVE DESIRED OUTPUT
  22.     {
  23.         if (i%2 != 0)  
  24.         {
  25.             prod = prod+i;
  26.         }
  27.     }
  28.     printf("%d",prod);
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.   //--FIXED PART - DO NOT EDIT ANY THINGS HERE
  39.   printf("\n");
  40.   system ("pause");
  41.   return(0);
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement