JoyMozumder

Even number(any range)

Jan 24th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int start,end,i;
  5. scanf("%d%d",&start,&end);
  6. if(start<=end)
  7. {
  8. for(i=start;i<=end;i++)
  9. {
  10. if(i%2==0)
  11. {
  12. printf("%3d",i);
  13. }
  14. }
  15. }
  16.  
  17. if(start>end)
  18. {
  19. for(i=start;i>=end;i--)
  20. {
  21. if(i%2==0)
  22. {
  23. printf("%3d",i);
  24. }
  25. }
  26. }
  27.  
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment