# Accenture C Questions

1)Write a C program to find a peculiar two digit number which is three times the sum of its digits.

2) Bacteria are known to multiply very rapidly. If a certain container contains just one bacterium on the first day and there are twice as many on the next day. In this manner the number of bacteria in the container doubles itself everyday. Assuming that the container would be full on the 10th day with 13,312 bacteria, find the number of bacteria that was initially in the container on the first day.

3) Calculate the factorial of a number recursively. From that calculate the value of COS(X) = 1 - X2/2! + X4 /4! - X6/ 6! +…….

4) A number of “Cats” got together and decided to kill between them 999919 mice. Every cat killed equal number of “mice”. Write a program to find number of cats.

5) Consider the following number 45*45=2025; 20+25=45.Write a program to generate number between 32 and 99 that satisfies the above property.

6) Rita has a money pouch containing Rs.700. There are equal number of 25 paise coins, 50 paise and one rupee coins. Write a C program to find how many of each are there?

7) Calculate the factorial of a number recursively and from that calculate the value of ex=1+ (X1/1!) + (X2 /2!) + (X3/3!) + ……….

8) There are some goats and ducks in a farm. There are 60 eyes and 86 foot in total. Write a program to find number of goats and ducks in the farm.

9) Write a C program to find a three digit number which is greater than the aggregate of its third, tenth and the twelfth parts by 58.

10) Write a C program to find a two digit number, the second digit of which is smaller than its first digit by 4, and if the number was divided by the digit’s sum, the quotient would be 7.

#### meenu1992 Profile Answers by meenu1992

• Oct 23rd, 2009

6) Rita has a money pouch containing Rs.700. There are equal number of 25 paise coins, 50 paise and one rupee coins. Write a C program to find how many of each are there?

#include<stdio.h>
#include<conio.h>
void main()
{long int i,j,k;
long int n=70000;
for(i=1;i<=100;i++)
for(j=1;j<=100;j++)
for(k=0;k<=100;k++)
{if(((25*i)+(50*j)+(100*k))==n)&&(i==j==k))
printf("25 paise %dn 50 paise %dn one rupee %dn",i,j,k)
}
getch();
}

#### krisprakas Profile Answers by krisprakas

• Feb 1st, 2010

For the question of number of bacterias:
int x=1;,y,i;
for(i=0;i<10;i++)
x=x*2;
y=13312/x;
printf("%d",y);

#### ramakrishnavaitla Profile Answers by ramakrishnavaitla

• Jun 21st, 2010

main()
{
int i,j,k;
for(i=32; i<99;i++)
{
j=i*i;
k=(j%100)+(j/100);
if (k==i)
{
printf("the required number is %d",i);
}
}
}

#### ramakrishnavaitla Profile Answers by ramakrishnavaitla

• Jun 21st, 2010

#include<stdio.h>
#include<conio.h>
main()
{
int i,;
for(i=10; i<99;i++)
{
if((i/10)==(i%10)+4)
{
if(i/((i/10)+(i%10))==7)
{
printf("%d",i);
break;
}
}
}
getch();
}

#### shiva074 Profile Answers by shiva074

• Jun 22nd, 2010

/*program to find a peculiar two digit number which is three times the sum of its digits*/#include<stdio.h>
#include<conio.h>
void main()
{
int dig=10,f,s,e1,e2;
clrscr();
while(dig<100)
{
s=dig%10;
f=dig/10;
e1=dig;
e2=3*(f+s);
//printf("e1=%d e2=%dn ",e1,e2);
if(e1==e2)
printf("%d",dig);
dig++;
}
getch();

}

#### krischan Profile Answers by krischan

• Nov 22nd, 2010

Peculiar two digit number

void main()
{
int x,i,t,o;
for(i=10;i<=99;i++)
{ o=i/10;
t=i%10;
x=o+t;
if(i==3*x)
{ printf("%d",i) ;
break;
} } }

#### krischan Profile Answers by krischan

• Nov 22nd, 2010

Q 6.
#include<stdio.h>
void main()
{
float x=1.75/700;
printf("%f",x);
getch();
}

#### krischan Profile Answers by krischan

• Nov 23rd, 2010

1)Write a C program to find a peculiar two digit number which is three times the sum of its digits.

#include<stdio.h>
void main()
{
int i=0,x,y;
clrscr();
for(i=10;i<=99;i++)
{
x=i/10;
y=i%10;
if(i==(x+y)*3)
printf("the number is %d",i);
}
getch();
}

2) Bacteria are known to multiply very rapidly. If a certain container contains just one bacterium on the first day and there are twice as many on the next day. In this manner the number of bacteria in the container doubles itself everyday. Assuming that the container would be full on the 10th day with 13,312 bacteria, find the number of bacteria that was initially in the container on the first day.

#include<stdio.h>
#include<math.h>
void main()
{
int i=13312;
int x=i/pow(2,9);
printf("%d",x);
getch();
}

4) A number of “Cats” got together and decided to kill between them 999919 mice. Every cat killed equal number of “mice”. Write a program to find number of cats.

#include<stdio.h>
void main()
{
long int x=999919,i;
clrscr();
for(i=2;i<=999919;i++)
{
if(x%i==0)
{
printf("n%ld",i);
}
}
getch();
}

5) Consider the following number 45*45=2025; 20+25=45.Write a program to generate number between 32 and 99 that satisfies the above property.

#include<stdio.h>
void main()
{
int i,x,y,z,l;
clrscr();
for(i=32;i<=99;i++)
{
x=i*i;
y=x/100;
z=x%100;
l=z+y;
if(l==i)
printf("%d ",i);
}
getch();
};

6) Rita has a money pouch containing Rs.700. There are equal number of 25 paise coins, 50 paise and one rupee coins. Write a C program to find how many of each are there?

#include<stdio.h>
void main()
{
int a=700;
float x=0.25+0.50+1;
printf("%0.1f 25 paise coins , 50 paise coins ,  one rupee coins",a/x);
getch();
}

10) Write a C program to find a two digit number, the second digit of which is smaller than its first digit by 4, and if the number was divided by the digit’s sum, the quotient would be 7.

#include<stdio.h>
void main()
{
int i,x,y,z;
clrscr();
for(i=40;i<=99;i++)
{
x=i/10;
y=i%10;
if(x-4==y && (i/(x+y))==7)
{
printf("%d ",i);
}
}
getch();
}