Function without argument without return value

Function without Argument

Function with no argument means the called function does not receive any data from calling function and Function with no return value means calling function does not receive any data from the called function. So there is no data transfer between calling and called function.

 #include<stdio.h>

#include<conio.h>

int myfunction() 

{

   printf("This function takes no argument, But returns 50\n");

   return 50;

}

main() {

   int x;

   x = myfunction();

   printf("Returned Value: %d", x);

}

More Example

C Program to find prime number

#include <stdio.h>

#include<conio.h>

void checkPrimeNumber();

int main()

{

 checkPrimeNumber();   

  return 0;

}

void checkPrimeNumber()

{

    int n, i, flag = 0;

    printf("Enter a positive integer: ");

    scanf("%d",&n);

    for(i=2; i <= n/2; ++i)

    {

        if(n%i == 0)

        {

            flag = 1;

        }

    }

    if (flag == 1)

        printf("%d is not a prime number.", n);

    else

        printf("%d is a prime number.", n);

}

2 Comments

Previous Post Next Post