write a program to find a given no. is divisible by 3 or not
without using any arthimetic operators?
Answer Posted / siva prabhu
#include<stdio.h>
int main()
{
int x,y,i=0,j=0,r=0;
printf("enter a num\n");
scanf("%d",&x);
if(x>3)
{
while(x>0)
{
i=0;
while(i<3)
{
--x;
++i;
}
++j;
if(x<3)
{
r=x;
printf("reminder is %d\n",x);
break;
}
}
if(r==0)
printf("the given is divisible by 3\n");
else
printf("the given no. is not %% by %3\n");
}
else
{
printf("the given no. is not %% by %3\n");
}
return 0;
}
| Is This Answer Correct ? | 10 Yes | 3 No |
Post New Answer View All Answers
What is the code for 3 questions and answer check in VisualBasic.Net?
what is recursion in C
Explain high-order and low-order bytes.
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year
I heard that you have to include stdio.h before calling printf. Why?
If errno contains a nonzero number, is there an error?
What is a macro?
Is using exit() the same as using return?
which of the following shows the correct hierarchy of arithmetic operations in C a) (), **, * or/,+ or - b) (),**,*,/,+,- c) (),**,/,*,+,- d) (),/ or *,- or +
Explain pointer. What are function pointers in C?
What are predefined functions in c?
What is a function in c?
What is the purpose of macro in C language?
What is the translation phases used in c language?
What happens if header file is included twice?