I feel this can be used for generic
#include <stdio.h>
main()
{
char a[50] = {0};
int k,l=0;
scanf("%s", a);
k = atoi(a);
while(k)
Type: Posts; User: venu
I feel this can be used for generic
#include <stdio.h>
main()
{
char a[50] = {0};
int k,l=0;
scanf("%s", a);
k = atoi(a);
while(k)
If you give only 3 digits, then it will ask user for two more digits. It will calculate summation for first five digits entered.
Hi,
If you want to take each number into separate variable, you can go with this.
main()
{
int i,j,k,l,m;
scanf("%1d%1d%1d%1d%1d",&i,&j,&k,&l,&m);
printf("%d",i+j+k+l+m);
}