Create a nested if-else block to check if a number is divisible by 3 or 5 or both.
Answers
Answered by
1
Answer:
Explanation:
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
if(n%3==0){
printf("divisible by 3");
}else if(n%5==0){
printf("divisible by 5");
}
else if((n%3==0) &&(n%5==0)){
printf("divisible by both 3 and 5");
}
}
Similar questions