i need help with a program i am writing a in c++ and Java .a program that when i input a figure like 2345 it will sum the figure up by adding 2+3+4+5 can any one help some one give me some code int a = 0 int i = atoi(argv[1]); while (i) { a += i%10; i /= 10; } printf("%d\n", a); but it does not run.

Recommended Answers

All 2 Replies

Apparently someone has already done part of your homework for you.

This list doesn't usually do people's homework for them. Why not ask the person who did the first part to do the rest of it?

may be it is ma homework and dat some one who did dat for ma was just try to help pls if u can help pls help . the problem wit the code it that it convert i am not to convert.and moreover it does not display the output. after i enter the value it will not display the result pls if u can help me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.