Sunday, March 16.

Header Ads

Colorful+Black+Friday+Discount+Leaderboard+Ad

Function Without Argument But Return Value

Muscle+Inc.+%25282%2529

.com/img/a/

Function Without Argument But Return Value

इस प्रकार के Function में हम Calling Function से कोई मान , User Defined Function में प्रदान नहीं करते हैं, लेकिन Calling Function को मान Return किया जाता है | इस तरह के Function व्यवहारिक तौर पर बहुत ही कम प्रयोग में आते हैं |

Example

  Factorial ज्ञात करने का प्रोग्राम Function के प्रयोग से बनाइये |

 

Program


#include<stdio.h>
main()
{
	int a,b;
	
	printf("Enter the factorial value :");
	scanf("%d",&a);
	b=fact(a);
	printf("fact= %d",b);
	getch();
}
fact(int x)
{
	int i, sum=1;
	for(i=1; i<=x; i++)
	sum *=i;
	return(sum);
}



No comments

Post Top Ad

Post Bottom Ad