Posts

Details in Algorithm

                                    Algorithm ●Definition of Algorithm Algorithm can be defined as "A sequence of steps to be carried out for a required output from a certain given input". There are 3 main features of algorithm from its definition: The essential aim of an algorithm is to get a specific output, An algorithm involves with several continuous steps, The output comes after the algorithm finished the whole process. ●Algorithm Analysis Efficiency of an algorithm can be analyzed at two different stages, before implementation and after implementation. They are the following − A Priori Analysis − This is a theoretical analysis of an algorithm. Efficiency of an algorithm is measured by assuming that all other factors, for example, processor speed, are constant and have no effect on the implementation. A Posterior Analysis − This is an empir...

C program

Reverse the given number using recursion. #include <stdio.h> int main (){ int num , reverse_number ; //User would input the number printf ( "\nEnter any number:" ); scanf ( "%d" ,& num ); //Calling user defined function to perform reverse reverse_number = reverse_function ( num ); printf ( "\nAfter reverse the no is :%d" , reverse_number ); return 0 ; } int sum = 0 , rem ; reverse_function ( int num ){ if ( num ){ rem = num % 10 ; sum = sum * 10 + rem ; reverse_function ( num / 10 ); } else return sum ; return sum ; } Output: Enter any number : 23456 After reverse the no is : 65432