Advertisement
7_2009-2012 Miscellaneous #239216

the programme

it displays the sum of digits of any no.

AI

AIサマリー: 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.

ソースコード
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();
}
オリジナルのコメント (3)
Wayback Machineから復元