Hi , guys i have problem to solve this i write the code and didn't give any error but give me wrong answer when i run the program
This is the problem:
Write a program that prompts user to enter an integer number and determines whether it is
even or odd , whether it is divisible by 5 and 7 , whether it is divisible by 5 or 7 , whether it is
divisible by 5 or 7 , but not both .
This is the code i write
Code:#include<stdio.h> void main() { int num = 0 , remainder = 0; int num1 = 0 , num2 = 0; printf("please Enter an integer number:"); scanf("%d" , &num); { remainder = num %2; if (remainder==0) printf("%d is Even number \n " ,num); else printf("%d is Odd number \n " ,num); } { num1 = num %5; num2 = num %7; { if((num1==0) && (num2==0)) printf("%d true \n"); else printf("%d false \n"); } { if((num=1==0) || (num2==0)) printf("%d true \n"); else printf("%d false \n"); } { if(((num1==0) || (num2==0)) && ((num1==0) && (num2==0))) printf("%d true \n"); else printf("%d false \n"); } } }



1Likes
LinkBack URL
About LinkBacks



