# C program to find 2 Digit Number

Write a program in C to find the 2 digit number which is 3 times its sum of its digits.

Piyush Dixit Profile Answers by Piyush Dixit Questions by Piyush Dixit

• Member Since Sep-2009 | Sep 18th, 2009

main()
{
int num,sum,i;
for(num=10;num<100;num++)
{
if(num==3*(num%10+num/10))
{
printf("%d",num);
}
}
}

#### bhuppicbaba Profile Answers by bhuppicbaba

• Nov 19th, 2008

#include<stdio.h>
void main()
{
int i,a,c;
for(i=10;i<=99;i++)
{a=i;
c=i%10;
a=a/10;
if(i==(3*(c+a)))
{
printf("%d",i);
getch();
}
}
getch();
}

#### hydsarema Profile Answers by hydsarema

• Nov 25th, 2008

#include<stdio.h>
void main()
{
int i,t,r,s,x;
clrscr();

for(i=10;i<=99;i++)
{
s=0;
t=i;
while(t!=0)
{
r=t%10;
t=t/10;
s=s+r;
}
x=(3*s);
if(x==i)
printf("%dn",i);
}
getch();
}

#### tarun88 Profile Answers by tarun88

• Jan 8th, 2009

#include<stdio.h>
#include<conio.h>

void main()
{
int i,o,t;
clrscr();
for(i=10;i<=99;i++)
{
o=i%10;
t=i/10;
if(3*(o+t)==i)
{
printf("the req num is = %d",i);
break;
}
}
getch();
}

#### dharris999 Profile Answers by dharris999

• Jan 30th, 2009

#include <stdio.h>
main()
{
int x, y;
for (x=0; x<=9; x++)
for (y=0; y<=9; y++)
if (((x*10)+y) == (3*(x+y)))
printf("%d%dn", x, y);
}

#### gamepaln22sep Profile Answers by gamepaln22sep

• Jun 24th, 2009

#include<stdio.h>
void main()
{
int num,i,sum=0,rem=0;
for(i=10;i<100;i++)
{
num=i;
while(num!=0)
{
rem=num%10;
sum=sum+rem;
num=num/10;
}
if((3*sum)==i)
{
printf("number:=%d",i);
sum=0;rem=0;
break;
}

sum=0;rem=0;
}
}

#### manikandansit Profile Answers by manikandansit

• Aug 21st, 2009

#include<stdio.h>
#include<conio.h>

void main()
{
int i,a,b,c,d;
clrscr();
printf("peciluar no r");
for(i=10;i<100;i++)
{
b=1;
c=0;
a=i;
while(a>0)
{
b=a%10;
a=a/10;
c=c+b;
}
c=c*3;
if(c==i)
printf("%d",i);

}getch();
}//by manikandan

#### Piyush Dixit Profile Answers by Piyush Dixit

• Sep 18th, 2009

main()
{
int num,sum,i;
for(num=10;num<100;num++)
{
if(num==3*(num%10+num/10))
{
printf("%d",num);
}
}
}

#### suyogpatil09 Profile Answers by suyogpatil09

• Sep 29th, 2009

bolean a;
while(a)
{
for(i=10;i<=99;i++)
{
int x,y,z;
x=i/10;
y=i%10;
z=(x+y)*3;

if(i==z)
{
a=false;
printf("%d",i);
}
}
}

#### shwetha.s Profile Answers by shwetha.s

• Oct 11th, 2009

#include<stdio.h>
main()
{
int i,j;
for(i=10;i<100;i++)
{
j=(i/10)+(i%10);
if(i==(3*j))
printf("%dn",i);
}
}

#### terna_engg Profile Answers by terna_engg

• Oct 13th, 2009

#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
int i,j;
for(i=0;i<9;i++)
{
for(j=0;j<9;j=+)
{
if(((i*10)+j)=(3*(i+j)))
{
printf("%dn",10i+j);
}
else
{
printf("no number is found");
}
}
}
}

#### tonitrus_knight Profile Answers by tonitrus_knight

• Jun 26th, 2010

void main()
{
int i;
for(i=10;i<100;i++)
{
if(i==3*((i/10)+(i%10)))
printf("%d",i);

}

#### Pavanrikki Profile Answers by Pavanrikki

• Jul 8th, 2010

int determine()
{
int m,n,k,flag=0,i=0;
for(i=11;i<99;i++)
{
k=i; m=k%10; n=k/10;
if((3*(m+n))==i)
{
printf("%dn",k);
}
}
}

#### kar.shiladitya Profile Answers by kar.shiladitya

• Oct 17th, 2010

main()

{
int i; //datatype declaration

printf("The required numbers are:n"); //print the statement
for(i=10;i<100;i++) //calculate all 2 digit numbers
{
if(i==3*((i%10)+(i/10))) //satisfy the problem statement
printf("%dn",i); //print the numbers that satisfies the problem

}

}

#### prititripathi Profile Answers by prititripathi

• Oct 29th, 2010

main()
{
int n,s,i;
for(i=10;i<=99;i++)
{
if(n==3*(s%10+s/10)
printf("%d",n);
}
getch();
}

#### rahulshrimali Profile Answers by rahulshrimali

• Mar 3rd, 2011

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,l;
clrscr();
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
k = (i+j)*3;
l = 10*i + j;
if(k != 0 && l !=0)
{
if(k == l)
printf("%dn",l);
}
}
}
getch();
}

#### crazysujith10 Profile Answers by crazysujith10

• May 17th, 2011

no number is printed  