The main function can call other functions to do some special task. The execution of the program always starts from the main function and ends with the main function. Every program must have at least one function with the name main. The C program is made of one or more pre-defined/ user-defined functions. Hence C is a function-oriented programming language. In C a big program divided into several small subroutines/functions/procedures. The function is a small program that is used to do a particular task. For example, the main is a function and every program execution starts from the main function in C programming. Similarly, 9 is not a prime number because it has more than 2 factors that are 1,3, and 9.Ī function is a block of code that performs a specific task. In this post, we will write a C program to find the prime number using a function and find all prime numbers in a given range.Ī natural number that has only two factors ( 1 and itself ) is called a prime number. For example- 5 is a prime number because it has only two factors 1 and 5. Previously we developed a C program to check whether the given number is a prime number or not? Now, we will do the same but using a function.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |