C Program to Calculate Generic Root of a Number using Ternary Operator
Satish B
http://technotip.com/6779/c-program-to-calculate-generic-root-of-a-number-using-ternary-operator/
Lets write a C program to calculate Generic Root of a Number using Ternary Operator or Conditional Operator.
Logic To Find Generic Root of a Number using Ternary Operator (result = num % 9) ? result : 9;
We divide the user input number by 9 and store the remainder inside variable result. If the number is perfectly divisible by 9 or if the result is zero then we output 9 orelse we output the value present in variable result. Variable result will have the Generic Root of the user entered number.
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=CpEOFsvQtGg
6859203 Bytes