Advertisement
5_2007-2008 Miscellaneous #194180

the programme

it displays the sum of digits of any no.

AI

Résumé par IA: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Code source
original-source
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
long int n,c,a,e;
int sum=0,d,i;
printf("enter any no.and no.of digits");
scanf("%ld",&n);
scanf("%d",&d);
for(i=0;i<d;i++)
{
sum=sum+(n/10^i)%10;
}
printf("the sum of digits is %d",sum);
getch();
}
Commentaires originaux (3)
Récupéré via Wayback Machine