We were required to write a program to check whether the
given number was of the form 3^n. ( i.e. 3 to the power n).
I knew that it can be done by bit manipulation but couldn't
make out the logic.
i want a solution in C/C++ language
Answer / sreejesh1987
#include<stdio.h>
#include<conio.h>
void main()
{
int count=0,n,d;
clrscr();
printf("\tDigit 3powern\n");
printf("Enter a no:");
scanf("%d",&n);
d=n;
while(d%3==0)
{
d=d/3;
count++;
}
if(d==1)
printf("\nNumber %d is of 3^%d format",n,count);
else
printf("\nNumber %d is not in 3^n format",n);
getch();
}
| Is This Answer Correct ? | 17 Yes | 6 No |
45% of 1500 + 35% of 1700 = ?% of 3175 (a) 40 (b) 55 (c) 45 (d) 35 (e) None of these
Three friends divided some bullets equally. After all of them shot 4 bullets the total number of bullets remaining is equal to the bullets each had after division. Find the original number divided?
Please send me the Karur Vysya Bank Clerk exam previous model papers to shekar96@gmail.com
14 Answers Karur Vysya Bank KVB, KVB, L&T, Sugen, TCS,
14.60 x ? + 13.5 = 50
series: ??,55,66,48,61,74,60,75,90
A company installed 36 machines at the beginning of the year. In March they installed 9 additional machines and then disconnected 18 in August. How many were still installed at the end of the year.
2 people are playing chess daily..31 days of month..loser gives 2rs to winner per mathes..whole amt will pay at the end of month..one man gives 38rs to other & he had win 5 mathes..then how many mathes are tie??? option a)2 b)8 c)4
9 Answers Mobisoft Infotech, Zycus Infotech,
Which number does not belong to this series 1,1,2,3,4,5,8,13,21?
Selling a ac gains 25% on SP.what %gain on CP. 15 25 33.33 47.5
sir i want the book for managerial aptitude for apsrtc jobs.if u know send to my mail arun9risingsun@yahoo.com
In a certain company, 20% of the men and 40% of the women attended the annual company picnic. If 35% of all the employees are man, what percent of all the employees went to the picnic?
a man has some hens and cows. If the number of heads be 48 and the number of feet equals 140, then the number of hens will be?