Showing posts with label c example. Show all posts
Showing posts with label c example. Show all posts

Sunday, April 5, 2020

C Example Program To Search Given Number In Array |C Programming Example

C Program Example To Search Given Number In Array

  This Article From Learn c programming in Hindi Will help you to learn To Search Given Number In Array, C programming language Example and check out "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".

C Programming Example
C Programming Example


नीचे C Program Example किसी दिए गए नंबर को एक ऐरे में सर्च करेगा और मौजूद होने पर सर्च किए गए नंबर की लोकेशन को दिखाएगा।


Source Code For C Programming Example



#include <stdio.h>
 
int main()
 
{
 
   int arr[250], search, n, i;
 
   printf("Please enter how many elements should be available in an array\n");
 
   scanf("%d",&n);
 
 
 
   printf("\nPlease enter %d numbers or integers one by one", n);
 
 
 
   for (i = 0; i < n; i++)
 
      scanf("%d", &arr[i]);
 
 
 
   printf("\nPlease enter the number you want to search");
 
   scanf("%d", &search);
 
 
 
   for (i = 0; i < n; i++)
 
   {
 
      if (arr[i] == search)  
 
      {
 
         printf("\n%d is present at location %d\n", search, i+1);
 
         break;
 
      }
 
   }
 
   if (i == n)
 
      printf("%d is not available in the array.\n", search);
 
   return 0;
 
}


Output

Please enter how many elements should be available in an array

3

Please enter 3 numbers or integers

10

20

30

Please enter the number you want to search

20

20 is present at location 2

c program to sort n numbers in ascending order | C Programming Example

 C Program Example To Sort Given Number In Ascending Order Without Variable

This Article From Learn c programming in Hindi Will help you to learn To Sort Given Number In Ascending Order, C programming language Example and check out "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".

C Programming Example
C Programming Example


नीचे दी गई संख्याओं को आरोही क्रम में क्रमबद्ध करने के लिए C Program Example है। यह तर्क को क्रमबद्ध करने वाले अवरोही क्रम के समान है। तर्क में <(इससे कम) के बजाय बस> (अधिक से अधिक) का उपयोग करें।

Source Code For C Program Exaple


#include <stdio.h>
 
int main ()
 
{
 
   //int i,j,a,n,number[15];
 
     int i,j,a,n=5,number[15];
 
   /*
 
       printf ("\nPlease enter how many numbers you want to sort");
 
       scanf (""%d"", &n);
 
       printf ("\nPlease enter the numbers to be sorted as ascending order");
 
       for (i=0; i number[j])
 
     {
 
       a= number[i];
 
       number[i] = number[j];
 
       number[j] = a;
 
     }
 
   }
 
 }
 
 printf ("\nAscending order of entered numbers");
 
for (i=0; i<n; ++i)
 printf ("\n%d",number[i]);
}

OUTPUT


Ascending order of entered numbers

1

3

4

6

7

C Program Example To Sort Given Number In Ascending Order With Variable


#include 
 
int main ()
 
{
 
     int i,j,a,n=5,number[15];
 
       printf ("\nPlease enter how many numbers you want to sort");
 
       scanf (""%d"", &n);
 
       printf ("\nPlease enter the numbers to be sorted as ascending order");
 
       for (i=0; i number[j])
 
     {
 
       a= number[i];
 
       number[i] = number[j];
 
       number[j] = a;
 
     }
 
   }
 
 }
 
 printf ("\nAscending order of entered numbers");
 
for (i=0; i<n; ++i)
 printf ("\n%d",number[i]);
}

Output


Numbers will be sorted in ascending order based on your entered numbers.

Copy Content Of One File To Another | C Programming Example

C Program Example For To Copy Content Of One File To Another


This Article From Learn c programming in Hindi Will help you to learn To Copy Content Of One File To Another, C programming language Example and check out "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".


C program Example
C program Example




नीचे C Program Example का उपयोग एक फ़ाइल की सामग्री को दूसरे में कॉपी करने के लिए किया जाता है। यदि आप फ़ाइल संचालन जैसे fopen (), fclose () पर Error Handling जोड़ना चाहते हैं, 

Source Code 

#include <stdio.h>
 
int main()
 
{
 
   char ch;
 
   FILE *fp1;
 
   FILE *fp2;
 
   /* Assume this test1.c file has some data.
 
      For example “Hi, How are you?” */
 
   if (fp1 = fopen("test1.c", "r"))
 
   {
 
      ch = getc(fp1);
 
      // Assume this test2.c file is empty
 
      fp2 = fopen("test2.c", "w+")
 
      while (ch != EOF)
 
      {
 
         fputc(ch, fp2);
 
         ch = getc(fp1);
 
      }
 
      fclose(fp1);
 
      fclose(fp2);
 
      return 0;
 
   }
 
   return 1;
 
}

Sort Given Names In Alphabetical Order | C Programming Example

C Program Example To Sort Given Names In Alphabetical Order


This Article From Learn c programming in Hindi Will help you to learn About "Sort Given Names In Alphabetical Order", C programming language Example and check out "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".


C programming Example
C programming Example

  • Source Code For C Programming Example : -


#include <stdio.h>
 
#include <string.h>
 
int main()
 
{
 
   int i, j, num;
 
   char name[20][10], t_name[15][10], temp[20];
 
 
 
   printf("Please enter how many number of names to be sorted in alphabetical order\n");
 
   scanf("%d", &num);
 
 
 
   printf("Please enter %d names one by one\n", num);
 
   for(i=0; i< num ; i++)
 
   {
 
      scanf("%s",name[i]);
 
      strcpy (t_name[i], name[i]);
 
   }
 
 
 
   for(i=0; i < num-1 ; i++)
 
   {
 
      for(j=i+1; j< num; j++)
 
      {
 
         if(strcmp(name[i],name[j]) > 0)
 
         {
 
             strcpy(temp,name[i]);
 
             strcpy(name[i],name[j]);
 
             strcpy(name[j],temp);
 
         }
 
      }
 
   }
 
 
 
   printf("Names before sorting in alphabetical order\n");
 
   for(i=0; i< num ; i++)
 
   {
 
      printf("%s\n",t_name[i]);
 
   } 
 
 
 
   printf("Names after sorting in alphabetical order\n");
 
   for(i=0; i< num ; i++)
 
   {
 
      printf("%s\n",name[i]);
 
   }
 
   
 
}

OUTPUT

Please enter how many number of names to be sorted in alphabetical order

Please enter 4 names one by one

thiyagu

raja

mani

Arul

Entered names before sorting in alphabetical order

thiyagu

raja

mani

Arul

Entered names after sorting in alphabetical order

Arul

mani

raja

thiyagu

Print Hello World Without Using Semi-Colon | C Program Example

 C Program Example To Print Hello World Without Using Semi-Colon : -


This Article From Learn c programming in Hindi Will help you to learn Print Hello World Without Using Semi-Colon, C programming language Example and check out "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".

C programming Example
C programming Example



Semi Colon का उपयोग किए बिना सी प्रोग्राम नीचे "हैलो वर्ल्ड" प्रिंट करेगा। यह कार्यक्रम हैलो वर्ल्ड प्रदर्शित करता है और फिर 11 (स्ट्रिंग "हैलो वर्ल्ड" की लंबाई) लौटाता है

#include 
 
int main() 
 
{
 
   if(printf("Hello World")) 
 
   { }
 
}

C Program Example To Reverse Number And String | C Programming Example

C Program Example To Reverse Number And String : -  


This Article From Learn c programming in Hindi Will help you to learn Program Example To Reverse Number And String and check out "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".


C programming exaple
C programming exaple

  • Source Code To Reverse Number With C Program Example


#include  
 
int main()
 
{
 
   int n, rev = 0;
 
   printf("Please enter a number to reverse\n");
 
   scanf(""%d"",&n);
 
 
 
   while (n != 0)
 
   {
 
      rev = rev * 10;
 
      rev = rev + n%10;
 
      n = n/10;
 
   }
 
 
 
   printf("The reverse of entered number is %d\n", rev);
 
   return 0;
 
}
  • Source Code To Reverse Number With C Program Example


#include
 
#include
 
int main()
 
{
 
   char name[30] = "Hello";
 
   printf("String before strrev( ) : %s\n",name);
 
   printf("String after strrev( )  : %s",strrev(name));
 
   return 0;
 
}

Output


Output:

String before strrev( ) : Hello

String after strrev( ) : olleH

C Program To Convert Lower To Upper Case And Vise Versa

  • C Program Example To Convert Lower Case To Upper Case And Vise Versa


This Article From Learn c programming in Hindi Will help you to learn About C Program Example To Convert Lower Case To Upper Case And Vise Versa and check out "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".

C Programming Example
C Programming Example


निचले मामले को ऊपरी मामले में बदलने के लिए नीचे C प्रोग्राम का उपयोग किया जाता है। strupr () फ़ंक्शन एक गैर मानक फ़ंक्शन है। तो, सभी संकलक समर्थन नहीं कर सकते हैं।

  • Source Code To Convert Lower Case To Upper Case In C Programming Example


	
#include
 
#include
 
int main()
 
{
 
    char str[ ] = "Modify This String To Upper";
 
    printf("%s\n",strupr(str));
 
    return  0;
 
}

OUTPUT

MODIFY THIS STRING TO UPPER

निचले मामले को ऊपरी मामले में बदलने के लिए नीचे C प्रोग्राम का उपयोग किया जाता है। strupr () फ़ंक्शन एक गैर मानक फ़ंक्शन है। तो, सभी संकलक समर्थन नहीं कर सकते हैं।

  • Source Code To Convert Upper Case To Lower Case In C Programming Example

#include
 
#include
 
int main()
 
{
 
    char str[ ] = "MODIFY This String To LOwer";
 
    printf("%s\n",strlwr (str));
 
    return  0;
 
}

OUTPUT


modify this string to lower

C Program For Armstrong Number | C Programming Example

Learn About Armstrong Number With C Programming Example : -


This Article From Learn c programming in Hindi Will help you to learn About "C Program For Armstrong Number" and check out "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".


C Programming Example
C Programming Example


किसी संख्या के अंकों का योग, कुल अंकों की संख्या को बढ़ाता है, आर्मस्ट्रांग संख्या है।

आर्मस्ट्रांग संख्या उदाहरण: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634 आदि।

स्पष्टीकरण:

3 = 3 ^ 1 = 3

153 = 1 ^ 3 + 5 ^ 3 + 3 ^ 3 = 153

गैर-आर्मस्ट्रांग संख्या:

156 = 1 ^ 3 + 5 ^ 3 + 6 ^ 3। यह मान 342 के बराबर है। इसलिए, 156 एक आर्मस्ट्रांग संख्या नहीं है

Source Code For Armstrong Number In C Program Example


	
#include 
 
int main()
 
{
 
   int n, sum = 0, t, remainder;
 
   printf("\nPlease enter a number to find whether it is an armstrong or not");
 
   scanf("%d",&n);
 
 
 
   t = n;
 
 
 
   while( t != 0 )
 
   {
 
      remainder = t%10;
 
      sum = sum + remainder*remainder*remainder;
 
      t = t/10;
 
   }
 
   if ( n == sum )
 
      printf("\nThe number %d is an armstrong number", n);
 
   else
 
      printf("\nThe number %d is not an armstrong number", n);
 
   return 0;
 
}


Swapping Program In C With Of Without Temp Variable | C programming Example

  • C Program Example For Swap Two Number 


This Article From Learn c programming in Hindi Will help you to learn C Program Example For Swap Two Number and check out "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".



C Programming Example
C Programming Example


अदला-बदली के सिवा कुछ नहीं है। यह उनके बीच विनिमय करने के लिए 2 नंबर या कुछ का मान हो सकता है। उदाहरण के लिए, नीचे दिए गए उदाहरण पर विचार करें।


  •      स्वैप करने से पहले, ए और बी के मूल्य नीचे दिए गए हैं।
     ए = 10
     बी = २०
  •      स्वैप करने के बाद, A और B का मान नीचे होगा।
     ए = 20
     बी = १०

Source Code For C Programming Example

#include 
int main()
{
   int A, B, temp;
 
   printf("Please enter the 1st number : ");
   scanf("%d",&A);
   printf("\nPlease enter the 2nd number : ");
   scanf("%d",&B);
 
   printf("\nBefore swapping:\n");
   printf("A - %d \nB - %d", A, B);
 
   temp = A;
   A = B;
   B = temp;
 
   printf("\nAfter swapping:\n");
   printf("A - %d \nB - %d", A, B);
 
   return 0;
}

OUTPUT : -

Please enter the 1st number : 20
Please enter the 2nd number : 30
Before swapping:
A – 20
B – 30
After swapping:
A – 30
B – 20

 

  • C Program Example For Swap Two Number Without Temp Variable


#include 
int main()
{
   int A, B;
 
   printf("Please enter the 1st number : ");
   scanf("%d",&A);
   printf("\nPlease enter the 2nd number : ");
   scanf("%d",&B);
 
   printf("\nBefore swapping:\n");
   printf("A - %d \nB - %d", A, B);
 
   A = A - B;
   B = A + B;
   A = B - A;
 
   printf("\nAfter swapping:\n");
   printf("A - %d \nB - %d", A, B);
 
   return 0;
}

OUTPUT : -


Please enter the 1st number : 45
Please enter the 2nd number : 67
Before swapping:
A – 45
B – 67
After swapping:
A – 67
B – 45

C Code example For Palindrome | C programming Example

 C Program Example For Palindrome

This Article From Learn c programming in Hindi Will help you to learn About Palindrome For C program Example and check out "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".

 
C Programming Example
C Programming Example

Learn About Palindrome For C program Example

  • जब एक संख्या या शब्द या एक वाक्यांश या वर्णों का एक क्रम जो उन्हें पिछड़े से पढ़ते समय समान होता है, उन्हें पैलिंड्रोम कहा जाता है।
  •      पॉलिंड्रोम उदाहरण: 2882, मैडम, दोपहर, स्तर।
  •      उपरोक्त उदाहरण समान हैं, जबकि उन्हें पिछड़े से भी पढ़ा जाता है। यदि आप पिछड़े से संख्या "2882" पढ़ते हैं, तो यह "2882" के समान है। यदि आप "मैडम" शब्द को पिछड़े से पढ़ते हैं, तो यह "मैडम" के समान है।

Source Code For Palindrome  : -



#include 
int main()
{
   int number, t, rev=0, rmndr;
 
   printf("Please enter a number to check Palindrome : ");
   scanf("%d",&number);
   printf("\nEntered number: %d", number);
 
   t = number;
 
   while (number > 0)
   {
      rmndr = number%10;
      rev = rev*10 + rmndr;
      number = number/10;
   }
   printf("\nReversed number: %d", rev);
 
   if(t == rev)
   {
      printf("\nEntered number %d is a palindrome", t);
   }
   else
   {
      printf("\nEntered number %d is not a palindrome", t);
   }
   return 0;
}


OUTPUT

Please enter a number to check Palindrome : 656
Entered number: 656
Reversed number: 656
Entered number 656 is a palindrome

Fibonacci Series Example With Programming Using C | C Simple Program

C Programming Example For Fibonacci Series

 This Article From Learn c programming in Hindi Will help you to learn Fibonacci Series With C programming language Example and check out "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".

 
C program Example
C program Example

Learn About Fibonacci Series with C Program Example



पहली श्रृंखला के दो नंबर 0 और 1. 3 नंबर से हैं। श्रृंखला में पिछली 2 संख्याओं का योग होगा।

फाइबोनैचि श्रृंखला: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, आदि।

C Program Example Source Code

	
#include 
int main()
{
   int f1=0, f2=1, fib_ser, cnt=2, lmt;
 
   printf("Please enter the limit of the Fibonacci series :");
   scanf("%d",&lmt);
   printf("\nFibonacci series is: \n%d \n%d \n",f1,f2);
 
   while (cnt < lmt)
   {
      fib_ser=f1+f2;
      cnt++;
      printf("%d\n",fib_ser);
      f1=f2;
      f2=fib_ser;
   }
   return 0;
}


OUTPUT


Please enter the limit of the Fibonacci series : 10
Fibonacci series is:
0
1
1
2
3
5
8
13
21
34

C Programming Example For Factorial | example in c programming

C Program Example For Factorial  



This Article From Learn c programming in Hindi Will help you to learn C Programming Example For Factorial and check out"C Program Example", "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".
 
c program example
c program example with output


Learn About Factorial With C Programming Example


  •      तथ्य को प्रतीक ! द्वारा निरूपित किया जाता है। उदाहरण के लिए, संख्या 4 के भाज्य को 4 के रूप में निरूपित किया जाता है। किसी संख्या का गुणनफल "शून्य और ऋणात्मक पूर्णांकों को छोड़कर उस संख्या से कम संख्या और सभी पूर्णांकों" के उत्पाद के रूप में परिभाषित किया गया है।


  •      प्राकृतिक संख्याएँ (गैर-नकारात्मक पूर्णांक) जो शून्य से अधिक हैं, का उपयोग भाज्य अवधारणा के लिए किया जाता है।

C Program Concept For Factorial 



शून्य तथ्य (0!) = 1
एक गुट (1!) = 1
दो गुट (2!) = 2 * 1 = 2
तीन गुट (3!) = 3 * 2 * 1 = 6
चार तथ्य (4!) = 4 * 3 * 2 * 1 = 24
पांच तथ्य (5!) = 5 * 4 * 3 * 2 * 1 = 120
आदि…

संख्या 'एन' के भाज्य को खोजने के लिए सामान्य गणितीय सूत्र नीचे दिया गया है।

n! = n (n - 1) (n - 2) (n - 3) …… (1)

#include 
int main()
{
   int i,fact=1,num;
 
   printf("\nPlease enter a number to find factorial : ");
   scanf("%d",&num);
 
   if (num<0 0="" 1="" a="" again.="" and="" be="" can="" d="" enter="" fact="" factorial="" find="" for="" found="" i="1;i<=num;i++)" is="" it="" n="" negative="" nfactorial="" nplease="" ntered="" num="" number="" only="" or="" positive="" pre="" printf="" return="" s="" t="" to="" try="" values.="">


OUTPUT FOR C PROGRAM EXAMPLE

Please enter a number to find factorial : 7
Entered number is 7 and it’s factorial (7!) is 5040

Saturday, April 4, 2020

C program example to check prime number | example in c programming


 C Program Example For Check Prime Number


This Article From Learn c programming in Hindi Will help you to learn C programming language Example and check out "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".


example in c programming
example in c programming

 Learn Prime Number with example in c programming



एक नंबर को प्राइम नंबर माना जाता है जब वह नीचे की शर्तों को पूरा करता है।

  •      यह पूरी संख्या होनी चाहिए
  •      यह 1 से महान होना चाहिए
  •      इसके केवल 2 कारक होने चाहिए। वे हैं, 1 और स्वयं संख्या।

प्रमुख संख्याओं के लिए उदाहरण: 2, 3, 5, 7, 11, 13, 17, 19, 23 आदि।

4, 6, 8, 9, 10, 12, 14, 15, 16 आदि क्यों अभाज्य संख्याएँ नहीं हैं?

क्योंकि, संख्या 4 को 2 * 2 और 1 * 4 के रूप में विभाजित किया जा सकता है। अभाज्य संख्या के नियम के अनुसार, केवल 2 कारक होने चाहिए। वे 1 और स्वयं संख्या हैं। लेकिन, नंबर 4 में 2 * 2 भी हैं। इस तरह, सभी शेष संख्या 6, 8, 9, 10, 12, 14, 15, 16 में 1 और संख्या के अलावा अन्य कारक हैं। तो, इन्हें प्राइम नंबर नहीं कहा जाता है।

c programs examples with output


#include 
int main()
{
   int i, num1, p1 = 0;
   printf("Please enter a number: \n");
   scanf("%d", &num1);
   for(i=1; i<=num1; i++)
   {
      if(num1%i==0)
      {
         p1++;
      }
   }
   if(p1==2)
   {
      printf("Entered number is %d "\
             "and it is a prime number.",num);
   }
   else
   {
      printf("Entered number is %d "\
             "and it is not a prime number.",num);
   }
}


Output

Please enter a number: 13
Entered number is 13 and it is a prime number.

C example learn to Use Gets() Function | c programs examples with output

 Learn To Use Gets() Function with example in c programming

 This Article From Learn c programming in Hindi Will help you to learn Use Gets() Function with example in c programming and check out "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".

 scanf() और gets () के बारे में कुछ महत्वपूर्ण बिंदु हैं:

  •     scanf() और gets () दोनों का उपयोग उपयोगकर्ता से इनपुट लेने के लिए किया जाता है।

  •      scanf() केवल तब तक इनपुट ले सकता है जब तक कि वह किसी स्थान का सामना नहीं करता। अंतरिक्ष के बाद के शब्दों को इसके द्वारा अनदेखा किया जाता है।

  •      gets () का उपयोग एक बार में एक इनपुट लेने के लिए किया जाता है, लेकिन इसे scanf() के विपरीत रिक्त स्थान के साथ एक पूरा वाक्य इनपुट करने के लिए उपयोग किया जा सकता है।

Use Below c programming practice questions gets ()

gets () एक बार में केवल एक ही लाइन लेता है यानी सभी शब्दों को Hiting से पहले \ n (Enter Key)।

c programs examples with output

#include

int main()
{
    printf("\n\n\t\tStudytonight - Best place to learn\n\n\n");

    char str[50];   // char array of size 50
    printf("Enter your complete name:\n\n\n");

    gets(str);
    printf("\n\nWelcome to Studytonight  %s\n\n\n", str);
    printf("\n\n\t\t\tCoding is Fun !\n\n\n");
    return 0;
}

Output

c programs examples with output
c programs examples with output


ASCII programming example in c

ASCII Value Of Character  With example for c program

 This Article From Learn c programming in Hindi Will help you to learn ASCII Value Of Character With example for c program and check out "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".

नीचे किसी भी इनपुट चरित्र के ASCII मूल्य को खोजने के लिए एक कार्यक्रम है।

% c Character को इनपुट के रूप में लेने का प्रारूप है

Programming example in c


#include

int main()
{
    printf("\n\n\t\tStudytonight - Best place to learn\n\n\n");

    char c;
    printf("Enter a character : ");
    scanf("%c" , &c);
    printf("\n\nASCII value of %c = %d",c,c);

    printf("\n\n\t\t\tCoding is Fun !\n\n\n");
    return 0;
}

OUTPUT

 

data types in c with example | c programming practice questions

Program Example For Input Of Various Datatype In C

This Article From Learn c programming in Hindi Will help you to learn data types in c with example and check out "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".

नीचे सी भाषा में उपलब्ध विभिन्न डेटाटाइप्स के लिए उपयोगकर्ता से इनपुट लेने का तरीका समझाने के लिए एक कार्यक्रम है। विभिन्न डेटाटाइप इंट (पूर्णांक मान), फ्लोट (दशमलव मान) और चार (चरित्र मान) हैं।

यहाँ सी भाषा ट्यूटोरियल विभिन्न डेटाटाइप्स की व्याख्या कर रही है → सी में डेटाटाइप्स

printf() का उपयोग स्क्रीन पर टेक्स्ट प्रदर्शित करने के लिए किया जाता है

& का प्रयोग वैरिएबल पर इनपुट वैल्यू को असाइन करने और उस विशेष स्थान पर स्टोर करने के लिए किया जाता है।

scanf() को आगामी ट्यूटोरियल में चर्चा किए गए प्रारूप विनिर्देशक का उपयोग करके उपयोगकर्ता से इनपुट लेने के लिए कहा जाता है

% d और% i, दोनों का उपयोग उपयोगकर्ता से इनपुट के रूप में संख्या लेने के लिए किया जाता है।

% f उपयोगकर्ता से इनपुट के रूप में फ्लोट लेने के लिए प्रारूप विनिर्देशक है

% s उपयोगकर्ता से इनपुट के रूप में चरित्र लेने के लिए प्रारूप निर्दिष्ट करता है

#include

int main()
{
    printf("\n\n\t\tStudytonight - Best place to learn\n\n\n");

    int num1, num2;  
    float fraction;     
    char character;

    printf("Enter two numbers number\n");
    
    // Taking integer as input from user
    scanf("%d%i", &num1, &num2);
    printf("\n\nThe two numbers You have entered are %d and %i\n\n", num1, num2);

    // Taking float or fraction as input from the user
    printf("\n\nEnter a Decimal number\n");
    scanf("%f", &fraction); 
    printf("\n\nThe float or fraction that you have entered is %f", fraction);

    // Taking Character as input from the user
    printf("\n\nEnter a Character\n");
    scanf("%c",&character);
    printf("\n\nThe character that you have entered is %c", character);

    printf("\n\n\t\t\tCoding is Fun !\n\n\n");
    
    return 0;
}


OUTPUT

 

data types in c with example
data types in c with example

Hello World Program in C | c programs examples with output

This Article From Learn c programming in Hindi Will help you to learn C programming language Example and check out "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".


Hello World Program in C


नीचे C भाषा में Hello World Program in c का एक साधारण प्रोग्राम प्रिंटिंग है।

Printf () हेडर फ़ाइल stdio.h के तहत एक प्रणाली परिभाषित फ़ंक्शन है, जिसका उपयोग स्क्रीन पर डेटा प्रिंट करने के लिए किया जाता है

\ n का उपयोग अगली पंक्ति पर नियंत्रण स्थानांतरित करने के लिए किया जाता है

\ t का उपयोग एक क्षैतिज टैब देने के लिए किया जाता है अर्थात् निरंतर पाँच स्थान

c programs examples with output


#include 

int main()
{
    printf("\n\n\t\tStudytonight - Best place to learn\n\n\n");
    int num;
    printf("\nHello world!\nWelcome to Studytonight: Best place to learn\n");
    printf("\n\n\t\t\tCoding is Fun !\n\n\n");
    return 0;
}

Output

Hello World Program in c
Hello World Program in c