C Program to Find First and Last Digit of a Number
Satish B
http://technotip.com/6766/c-program-to-find-first-and-last-digit-of-a-number/
Write a C program to find first and last digit of the user input number, without using looping.
if num = 123;
count = log10(num); // count = 2;
first = num / pow(10, count); // first = 1;
last = num % 10; // last = 3;
Both pow() and log10() are built-in methods present in header file math.h So we include that library file at the beginning of our C program source code.
C Programming Interview / Viva Q&A List http://technotip.com/6378/c-programming-interview-viva-qa-list/
C Programming: Beginner To Advance To Expert http://technotip.com/6086/c-programming-beginner-to-advance-to-expert/ ... https://www.youtube.com/watch?v=4D6kDTQNk6E
2020-07-21
0.0 LBC
Copyrighted (contact publisher)
5314006 Bytes