Bhuvan InfoTech Android App

Download our Android App and browse Technical News, Projects, Computer Tricks more easily with lots of Interesting Features.

Tuesday, June 14, 2016

Sum of two numbers using for loop | C program

#include <stdio.h>
int main()
{
 int no, sum;
 
 printf("Please enter a number: ");
 scanf("%d",&no);
 
 for(s=0;no>0;no=no/10)
 {
  sum = sum + no%10;
 }
 
 printf("Sum of digits is: %d", sum);
 return 0;
}
Bhuvan Arora

No comments:

Amazing Deal !