Topic-21: NAWR

No argument with return type(NAWR):

A “no argument with return type” function is a type of function in programming that does not take any arguments but returns a value upon execution.

Here’s the definition syntax for a no argument with return type function in C:

return_type function_name() { // Function body – code block where the functionality of the function is defined // You can perform operations, calculations, etc. here return value; // Return statement – specifies the value to be returned by the function }

Example:

//ADDITION OF RWO NUMBER BY USING –

// NO ARGUMENT WITH RETURN TYPE(NAWR)

#include<stdio.h>

int add()

{

int a=10 , b=20 , sum;

sum=a+b;

return sum;

}

int main()

{

int result;

result=add();

printf(“%d”,result);

return 0;

}

OUTPUT:-

30

Leave a Comment

Your email address will not be published. Required fields are marked *