Subscribe

RSS Feed (xml)

Monday, January 11, 2010

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

example:- 27
=3(2+7)
=3(9)
=27

#include< stdio.h>
#include< conio.h>
int main()
{
int n,sum=0,rem,temp;
clrscr();
printf("Enter any two digit number:");
scanf("%d",&n);
for(temp=n;temp>0;temp=temp/10)
{
rem=temp%10;
sum=sum+rem;
}
if(n==(sum*3))
printf("\nIts a Peculiar two digit number");
else
printf("\nNot a Peculiar two digit number");
getch();
return 0;
}

4 comments:

  1. thanks ...ede correct ga exute ayinde

    ReplyDelete
  2. write a C program for online software purchase?

    ReplyDelete
  3. Hi, Nice program to find a peculiar two digit number which is three times the sum of its digits.I worked it.I got the output.Thanks, its really helped me......

    -Aparna
    Theosoft

    ReplyDelete