Advertisement
touhid_xml

Detecting Odd and Even number in C

Apr 5th, 2016
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.19 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void){
  4. int i;
  5. for(i=0; i <=10; i++){
  6. int r = 1 + i;
  7. if(r%2 != 0){
  8. printf("%d is odd number\n",r);
  9. }else{
  10. printf("%d is even number\n",r);
  11. }
  12. }
  13.  
  14. return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement