BootStrap tutorials. Android tutorials. React Native tutorials. Kotlin tutorials. Dart tutorials. MongoDB tutorials. Privacy Policy. C program to find if two numbers are Amicable or not. The source code below uses a user defined function, long fun int y which is for the calculation of factorial whenever the function is called.
All variables x,y and z used in this program are of integer data type. Out these three variables, x and z are for loop control and y has been defined to store the number of rows entered by the user. Compile it in Code::Blocks. But, this alternative source code below involves no user defined function.
Here I will briefly describe the programming technique to help you understand the source code better. The output screen is same as in the previous case — with using function. The source code of the program consists of six integer type of variable, named x, y, n, a, z and s. The program assigns s with n, i. The process repeats till the control number specified is reached. A long type user defined function prototype name - "factorial " is being taken with parameter type as integer.
Then you have to define the main function and it has been declared as integer so by default it returns integer. Inside the main function you have to declare three integer type variable name - 'i', 'n' and 'c'. Pointers in C.
Find roots of a quadratic equation. Print Pyramids and Patterns. Check prime number. Print the Fibonacci series. Reference Materials string. Start Learning C. Explore C Examples.
0コメント