/* Problem 7 : Write a program that prompts the user to enter one positive 4 digits integer. The program will do the following: if the input number is even, the program will print the digits of the number in the reverse order, and if the input number is odd, the program will calculate the sum and the product of the digits and prints the result with the appropriate message. Hint: An even number is an integer that is "evenly divisible" by 2, i.e., divisible by 2 without remainder i.e., remainder = 0 */ #include int main(){ int num, d1, d2, d3, d4, sum, product; printf("enter 4-digit number \n"); scanf("%d",&num); if(num>=1000 && num<=9999){ d4=num%10; num=num/10; d3=num%10; num=num/10; d2=num%10; num=num/10; d1=num%10; if(d4%2==0){ printf("digits in reverse order\n"); printf("%d%d%d%d\n",d4,d3,d2,d1); } else{ sum=d1+d2+d3+d4; product=d1*d2*d3*d4; printf("sum=%d\nproduct=%d\n",sum,product); } } else{ printf("invalid input\n"); } return 0; }