hii
QUESTION: Take any 4 integers add them and print the first and last digit of the answer the restriction is that i can only use scanf command and data types..
I AM VERY THANK FULL IF SOMEBODY SOLVED MY PROBLEM

Recommended Answers

All 5 Replies

You need to ask questions about your program, rather than posting your assignment and saying "thanks" for the solution.

It is your assignment, after all. You won't learn by not working with it.

And Welcome to the Forum, Ahmed! ;)

thanks bro for replying i have made the prog but i totally stuck at the situation that how can i print first and last digit of the answer..

>i have made the prog
Then you shouldn't have any trouble proving it.

If you have a number in base 10 (normal base), and use the mod operator on it, what do you get?

int number = 123;
printf("\n %d", (number % 10));

now divide the number by 10. You've now "peeled off" the right most digit from the number.

You can continue doing this in a loop, until the number disappears. Save the first and the last digit, and there you go.

If you need any more help with your program, post your code so we can see the details of what you're referring to. Doesn't have to be the whole program, but at least the part you're referring to.

AND do use code tags around any posted code - please!

i am very vary thank full to u for this i have solved my problem

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.