#2 N тооны цифрүүдийн нийлбэрийг олдог бодлого

//N toonii tsipruudiin niilberiig ol
#include <stdio.h>
#include <conio.h>

main()
{
int n,s;

printf("n toog oruul:"); scanf("\n%d",&n);
s=0;
while(n>0)
{
s=s+n%10;
n=n/10;
}
printf("Tsipruudiin niilber: %d\n", s);
getch();
}

Post a Comment

0 Comments