Advertisements

Java code made by friend for my home work ;)


Smart people outsource to learn faster.

Thank you Zain Bhai, i don't know if you can read this rusty blog. Although there are no marks for this question given for brainstorming.

____________________

Question: A person is 40 years now. He has 32 teeth at the moment. At every passing odd year, his 2 teeth fall and an every passing even year, his 1 tooth falls. At what age, he will be toothless?

Code:

{
int a=40; b=32; z=0; c=0;
for(x=1; x<=21; x=x+1);
{
if(b!=0)
{
if(x%2==0)
{
b=b-1
c=c+1
}
else
{
if(x%2==1)
{
b=b-2
c=c+1
}
}
}
y=c+a
system.out.print(y)
}

0 did criticisms:

Related Posts Plugin for WordPress, Blogger...

Advertisement

MuddleHead Signs Off!!

MuddleHead Signs Off!!