SHARE
TWEET

Untitled

a guest Dec 3rd, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. void main()
  4. {
  5.     int i, num,  even_sum = 0;
  6.  
  7.     printf("Enter the value of num\n");
  8.     scanf("%d", &num);
  9.     for (i = 1; i <= num; i++)
  10.     {
  11.         if (i % 2 == 0)
  12.             even_sum = even_sum + i;
  13.     }
  14.     printf("Sum of all even numbers = %d\n", even_sum);
  15. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top