Friday, May 11, 2012

Program to check that entered no is divisible by 9 or not.


//program to check that entered no is divisible by 9 or not.
#include<stdio.h>
#include<conio.h>
main()
{ int n,r,s;
 printf("Enter the no ");
 scanf("%d",&n);
 s=0;
 while(r!=0)
 { r=n%10;
  n=n/10;
  s=s+r;
 }
 if(s%9==0)
 printf("Entered no is divisible by 9");
 else
 printf("Entered no is Not divisible by 9");
getch();
}

No comments:

Post a Comment