JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

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

Categories: C Language in hindi

some important examples in c language in hindi explanation with programming , c language programs

c language programs , some important examples in c language in hindi explanation with programming :-
अभी तक हमने topic wise उदाहरन को देखा है| अब इस article मे एसे उदाह्रानो को discuss करेगे जो की अभी तक discuss नहीं हुआ |
उदाहरण 1
Write a program to convert case of character in c language |
इस उदाहरण मे , यूजर द्वारा दिए गये character के case को change किया जाता है |
Explantion
इस उदाहरण मे ctype header file के कुछ function को use किया जाता है |
1.getchar () : इस function का use , यूजर द्वारा दिए गये character को read करने के लिए किया जाता है |
2.islower() : इस function का use , यूजर द्वारा दिए गये character के case को check  करने के लिए किया जाता है |अगर lower case तब ‘1’ return होगा अन्यथा ‘0’ return होगा |
3.toupper() : इस function का use , यूजर द्वारा दिए गये character के case को change  करने के लिए किया जाता है |अगर lower case  है तब upper case मे convert हो जाता है |
4.isupper():इस function का use , यूजर द्वारा दिए गये character के case को check  करने के लिए किया जाता है |अगर upper case  case तब ‘1’ return होगा अन्यथा ‘0’ return होगा |
5.tolower() : इस function का use , यूजर द्वारा दिए गये character के case को change  करने के लिए किया जाता है |अगर upper case  है तब lower case मे convert हो जाता है |
procedure
1.सबसे पहले यूजर से data को input करा लेते है :
2.उसके बाद islower() function से lower case को check किया जाता है |
3.अगर lower case तब toupper() से case को convert कर दिया जाता है |
4.अन्यथा tolower() से lower case मे convert कर देते है |
Source code :
#include<stdio.h>
#include<conio.h>
void main()
{
char a[12],b[12];
int i;
printf(“Enter String : “);
gets(a);
for(i=0;i<12;i++)
{
if(islower(a[i]))
{
b[i]=toupper(a[i]);
}
else
{
b[i]=tolower(a[i]);
}
printf(“Case Convert Form”);
puts(b);
getch();
}
उदाहरण 2
Write a program to find smaller and larger number using global variable in  c language .
इस उदाहरण मे ,Global variable से  दिए गये दो numbers से smaller और largest number को find करना है
Explanation
इस उदाहरण मे ,global variable को use किया जाता है :-
1. code को प्रोग्राम मे किसी भी जगह पर use कर सकते है और local variable को केवल प्रोग्राम मे use किया जाता है |
2.variable मे value को input करने के लिए ‘&’ का use किया जाता है |और %0nd का use किस number को represent करने के लिए किया जाता है |
procedure
1.सबसे पहले यूजर से data को input करा लेते है :
2.उसके बाद comparison होता है |
अगर दोनों number सामान होती है तब ‘Both Numbers are equal” का message display होगा |
अगर (num1<num2) हो तब Smallest Number : num1 और largest Number : Num2 display होगा |
अन्यथा Smallest Number : num2 और largest Number : Num1 display होगा |
Source code :
#include<stdio.h>
#include<conio.h>
int num1 , num2;
void main()
{
printf(“Enter Numbers : “);
scnaf(“%d %d “,&num1,&num2);
if(num1==num2)
{
printf(“Both Numbers are equal.”);
}
elseif(num1<num2)
{
printf(“Smallest Number : %d “,num1);
printf(“largest Number : %d “,num2);
}
else
{
printf(“Smallest Number : %d “,num2);
printf(“largest Number : %d “,num1);
}
getch();
}
आउटपुट होगा :
Enter Numbers : 12 34
Smallest Number : 12
largest Number : 34
और
Enter Numbers : 12 12
Both Numbers are equal.
उदाहरण 3
Write a program to check integer और float type in  c language .
इस उदाहरण मे , दिए गये number के type को check करता है|
Explanation
इस उदाहरण मे , यूजर द्वार दिए गये number को string की तरह treat करते है |
अगर string मे decimal है तब given number float type का है |
अन्यथा integer type है |
procedure
1.सबसे पहले यूजर से data को input करा लेते है :
2.उसके बाद strlen() function से given data की length calculate  कर देते है |
3.loop चलाया जाता है |loop की body मे
string के सभी element को ‘.’ से check किया जाता है अगर ‘.’ है तब count की value ‘1’ set हो जाती है break statement से loop terminate हो जाता है |
4.अगर count की value 1 है तब
‘ The type of number is Float . ‘ display होगा |
अन्यथा ‘ The type of number is Integer . ‘ display होगा |
Source Code
#include<stdio.h>
#include<conio.h>
void main()
{
char num[12];
printf(“Enter Number : “);
gets(num);
int count =0;
int i=0;
int length;
length=strlen(num);
while(num[i++]!=’/0′)
{
if(num[i]==’.’)
{
count=1;
break;
}
}
if(count==1)
{
printf(‘The type of number is Float .”);
}
else{
printf(‘The type of number is Integer .”);
}
getch();
}
आउटपुट होगा :
Enter Number : 12
The type of number is Integer .
उदाहरण 4
Write a program to find normal and trace of a square matrix in c language .
इस उदाहरण मे , किसी square matrix के normal और trace को calculate किया जाता है |
Explanation
इस उदाहरण मे , निन्म keyword को संजना जरुरी है |
Normal और trace केवल square matrix के लिए किया जाता है |
Square Matrix : Square Matrix एसी matrix है जिसमे row और column की सख्या सामान होती है |
Normal : square root of sum of square of each elements of an array |
Trace : Sum of diagonal elements
Diagonal Element : एसे element जिसके लिए row और colunm की value सामान हो |
procedure
1.सबसे पहले यूजर से array के element के data को input करा लेते है :
2.Trace को calculate करने के लिए code को लिखते है |
3.Normal को लिखने के लिए code को लिखते है |
Source Code
#include<stdio.h>
#include<conio.h>
void main()
{
int a[3][3];
printf(“Enter elements : “);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scnaf(“%d”,&a[i][j]);
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
if(i==j)
{
trace =trace+a[i][j];
}
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
square=a[i][j]*a[i][j];
sum=sum+square;
}
}
int normal=sqrt(sum);
printf(“Noramal : %d”,normal);
printf(“Trace : %d”,trace);
getch();
}
Sbistudy

Recent Posts

सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है

सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…

13 hours ago

मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the

marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…

13 hours ago

राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए sources of rajasthan history in hindi

sources of rajasthan history in hindi राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए…

2 days ago

गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है ? gurjaratra pradesh in rajasthan in hindi

gurjaratra pradesh in rajasthan in hindi गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है…

2 days ago

Weston Standard Cell in hindi वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन

वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन Weston Standard Cell in…

3 months ago

polity notes pdf in hindi for upsc prelims and mains exam , SSC , RAS political science hindi medium handwritten

get all types and chapters polity notes pdf in hindi for upsc , SSC ,…

3 months 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