JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi sociology physics physical education maths english economics geography History

chemistry business studies biology accountancy political science

Class 12

Hindi physics physical education maths english economics

chemistry business studies biology accountancy Political science History sociology

Home science Geography

English medium Notes

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Class 12

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Categories: C Language in hindi

User Define Function : Return Type or Basic Examples in hindi यूजर डिफाइन फंक्शन हिंदी में

यूजर डिफाइन फंक्शन हिंदी में User Define Function : Return Type or Basic Examples in hindi in c computer language :-
पिछले articles मे हमने function का syntax को study किया है |लेकिन हमने return statement के  type को स्टडी नहीं किया है अब इस article मे हम return statement और basic प्रोग्राम(simple interest ,area ,even or odd,bigger value among three values ) के प्रोग्राम को देखगे |Return Statement :
Function difination मे return statement का अलग से महत्व है |return statement से user define function से केवल एकक value को main function मे transfer कर सकते है |इसका syntax है :-

return();      और    return(expression);

return statement दो प्रकार के होते है :-
Plain Return Statement :
return() को Plain Return Statement कहते है |ये statement main() function मे कोई value pass नहीं करता है |इसका मतलब है की function पूरा हो चूका है |जब भी Plain Return Statement आ जाता है उसके बाद COMPILER का  control main function मे चला जाता है |
उदहारण के लिए :
#include<stdio.h.
#include<conio.h.
void large(int,int);
void main()
{
int a,b;
printf(“Enter your data”);
scanf(“%d %d”,&a,&b);
large(a,b);
printf(“End of This Program”);
getch();
}
int large (int c, int d)
{
if(c<d)
{
printf(“%d is less than %d. “,c,d);
return();
}
else
{
printf(“%d is less than %d. “,d,c);
return();
}
}
इस उदाहरण मे , function large() मे जब condition (c<d) true होगा तब printf(“%d is less than %d “,c,d); execute होगा और complier का control main() function मे  मूव हो जाता है |और printf(“End of This Program”); execute होता है |
आउटपुट होगा :
Enter your data 34 45
34 is less than 45.
End of This Program

Return(expression);
इस statement से किसी expression के आउटपुट को main() function मे pass होता है |उदाहरण के लिए:
#include<stdio.h>
#include<conio.h.
float power(int,int);
void main()
{
int a,b,c,d;
printf(“Enter your data”);
scanf(“%d %d”,&a &b);
d=c+power(a,b);
printf(“Expression Output=%d”,)
Return statement मे constant value को भी पास कर सकते है |Return statement का default data type integer होता है |जब प्रोग्रामर किसी विशेष data type को pass करना चाहता है तब use function definition के header portion मे function type को change करना पड़ेगा |उदाहरण के लिए :
#include<stdio.h>
#include<conio.h>
void large(int,int);
void main()
{
int a,b,i;
printf(“Enter your data”);
scanf(“%d %d”,&a,&b);
i=large(a,b);
if(i==1
{
printf(“%d is less than %d. “,a,b);
}
else
{
printf(“%d is less than %d. “,b,a);
getch();
}
int large (int c, int d)
{
if(c<d)
{
return(1);
}
else
{
return(0);
}
}
इस उदाहरण मे , जब condition true होगी तब ‘1’ pass होगा और false होने पर ‘0’ pass होगा |

आउटपुट होगा :
Enter your data 56 76 
56 is less than 76.

अब हम कुछ basic प्रोग्राम को function से बनयेगे :
/*Program For
Calculate Simple Interest */
#include<stdio.h>
#include<conio.h>
int SI(int,Float,int );
void main()
{
int P,R,T;
printf(“Enter
Principal”);
scanf(“%d
“,&P);
printf(“Enter
Rate”);
scanf(“%f
“,&R);
printf(“Enter
Time”);
scanf(“%d
“,&T);
SI(P,R,T);
printf(“Thank
You!”)
getch();
}
int SI( int a,int b,int
c)
{
float s;
s=P*R*T/100;
Printf(“Simple
Intrest Is %f”,s);
return();
}
आउटपुट होगा :
Enter Principal 1000
Enter Rate 2.5
Enter Time 2
Simple Intrest is 50
Thank You!
/*Program
For Calculate Area of Circle */
#include<stdio.h>
#include<conio.h>
#define pi 22.7
float area(int);
void main()
{
int radius;
float area;
printf(“Enter
radius”);
scanf(“%d
“,&radius);
area=area(r);
printf(“Area is
%2f”,area);
printf(“Thank
You!”)
getch();
}
float area(int a)
{
float s;
s=pi*a*a;
return(s);
}
आउटपुट होगा :
Enter radius 5
Area is 567.50
Thank You!
/*Program
For find a number और not  */
#include<stdio.h>
#include<conio.h>
void even(int);
void main()
{
int number;
printf(“Enter
Number”);
scanf(“%d
“,&number);
even(number);
getch();
}
void even(int a)
{
if(a/2==0)
{
printf(“Number is Even.”)
return();
}
else
{
printf(“Number is not Even.”)
return();
}
}
आउटपुट होगा :
Enter number 5
Number is not Even.
Sbistudy

Recent Posts

four potential in hindi 4-potential electrodynamics चतुर्विम विभव किसे कहते हैं

चतुर्विम विभव (Four-Potential) हम जानते हैं कि एक निर्देश तंत्र में विद्युत क्षेत्र इसके सापेक्ष…

3 days ago

Relativistic Electrodynamics in hindi आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा

आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा Relativistic Electrodynamics in hindi ? अध्याय : आपेक्षिकीय विद्युतगतिकी…

4 days ago

pair production in hindi formula definition युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए

युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए pair production in hindi formula…

7 days ago

THRESHOLD REACTION ENERGY in hindi देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा

देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा THRESHOLD REACTION ENERGY in hindi…

7 days ago

elastic collision of two particles in hindi definition formula दो कणों की अप्रत्यास्थ टक्कर क्या है

दो कणों की अप्रत्यास्थ टक्कर क्या है elastic collision of two particles in hindi definition…

7 days ago
All Rights ReservedView Non-AMP Version
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings
JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now