Sum Of N digit Using String In C Program Tamil


#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<math.h>
void main()
{
   int n,i,a,tot=0,nu;
   char *str;
   clrscr();
   printf("\ENter the number");
   gets(str);
   n=strlen(str);
   nu=atof(str);
   for(i=0;i<n;i++)
   {
       a=nu%10;
       nu=nu/10;
       tot=tot+a;
   }
   printf("\nSum of digits : %d",tot);
   getch();
}

Login To Download Source Code

Leave a Comment:

Login To Comment

List Of Programs


Goto Examples

Operators

Looping

Number Conversion

Pattern Design

Arrays

Matrix Examples

Sorting Examples

String Function

Change Case

String In C

Maths Functions

User Defined Functions

Recursive Functions

Pointer

Structure

File Concept

Calender Programming