clanguage07@gmail.com

clanguage07@gmail.com

Saturday, June 16, 2012

FIND sum of individual digits ,c program

#include<stdio.h>
#include<stdio.h>
void main()
{
      int n,sum,p;
      clrscr();
      printf("enter the possitive integer:");
      scanf("%d",&n);
      sum=0;
      if(n<0)
      printf("\n the given number is not valid(not +ve)");
      else
      {
      while(n!=0)
      {
      p=n%10;
      n=n/10;
      sum=sum+p;
      }
      printf("\n sum of individual digits is:%d",sum);
      }
      getch();

No comments:

Post a Comment

GET MORE INFORMATION

http://ads.qadservice.com/t?id=c2168e05-8974-4816-872a-91936ff7379d&size=1024x768&drct=true