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
How many bytes are occupied by near, far and huge pointers (dos)?
How was c created?
What are directives in c?
1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.
Explain Basic concepts of C language?
What is the difference between malloc() and calloc() function in c language?
Is c is a procedural language?
Can you please explain the scope of static variables?
What is #include stdlib h?
How is a pointer variable declared?
code for find determinent of amatrix
How can you increase the size of a statically allocated array?
Do you know the difference between exit() and _exit() function in c?
Can we use visual studio for c?
When should you not use a type cast?