fork download
  1. #include <stdio.h>
  2.  
  3. #include <stdlib.h>
  4.  
  5.  
  6. int main(void) {
  7. int x;
  8. int y;
  9. printf("enter value x");
  10. scanf("%d", &x);
  11. printf("enter value y");
  12. scanf("%d", &y);
  13.  
  14. if(x%2==0 && y%2==1)
  15. {
  16. y = y -1;
  17. int fake = 0;
  18. for(int temp = 0;temp<=y; temp= temp+2)
  19. {
  20.  
  21.  
  22. x = x+temp;
  23. fake = fake + x;
  24. }
  25.  
  26. }
  27. if(x%2==1 && y%2==0)
  28. {
  29. x = x +1;
  30. int fake = 0;
  31. for(int temp = 0;temp<=y; temp= temp+2)
  32. {
  33.  
  34.  
  35. x = x+temp;
  36. fake = fake + x;
  37. }
  38. }
  39.  
  40. if(x%2==0 && y%2==0)
  41. {
  42. int fake = 0;
  43. for(int temp = 0;temp<=y; temp= temp+2)
  44. {
  45.  
  46.  
  47. x = x+temp;
  48. fake = fake + x;
  49. }
  50. }
  51.  
  52. if(x%2==1 && y%2==1)
  53. {
  54. x = x +1;
  55. y = y -1;
  56. int fake = 0;
  57. for(int temp = 0;temp<=y; temp= temp+2)
  58. {
  59.  
  60.  
  61. x = x+temp;
  62. fake = fake + x;
  63. }
  64. }
  65. printf("the sum is %d", &x);
  66. return 0;
  67. }
Success #stdin #stdout 0s 5276KB
stdin
Standard input is empty
stdout
enter value xenter value ythe sum is 1912716128