Friday, July 26, 2019

To sum n different number using array.

#include<stdio.h>
#include<conio.h>
Void main()
     {
         int a[20] n,  s=0,i;
         printf("Enter the number of values you want to insert in an array (max. 20);
         scanf("%d",&n);
         for(i=0;i<n;i++)
         {
   printf("\n Enter the %d value /t");
   scanf("%d",&a[i]);
   }
         for(i=0;i<n;i++)
       {
          s=s+a[i];
   }
          printf("\n the sum of the entered value is %d",s);
   }
      getch();
}

Friday, May 3, 2019

write a C program to calculate factorial of a user input number using for loop.

#include<stdio.h>
#include<conio.h>
     void main()
     {
     int fac , n , i = 1;
     clrscr();
     printf("Enter the number");
     scanf("%d",&n);
     fac = 1;
     for(i = 1; i< = n; i++)
         {
           fac = fac * i;
          }
      printf("\n factorial of %d is %d", n,  fac);
      getch();
}

Thursday, April 18, 2019

Type of Error In C Programming Language

There are three types of errors in C programming 
(1)Syntax errors
(2)Logical errors
(3)Run-time errors

(1) Syntax errors- These errors occur because of wrongly typed statement,  which are not according to the syntax or grammatrical rules of the language.
      For example- In C, if you don't place a semi-colon after the statement (as show below),  it       results in a syntax error. 
      printf("Hello word")
      Error in syntax (semicolon missing) 
      printf("Hello word");
      This statement is syntactically correct. 

(2) Logical errors- These errors occur because of logical incorrect instruction in the program. 
       For example - Let us assume that in a 1000 line program, if there should an instruction,  which multiplies two numbers and is wrongly Written to perform addition. This logically incorrect instruction may produce wrong result. Detecting such errors are difficult. 

(3) Run-time errors- These errors occur during the execution of the program though the program is free from syntax and logical errors.  Some of the most common reasons for these errors are-
       A. When you instruct your computer to divide a number by zero. 
       B. When you instruct your computer to find logarithm of a negative number. 
       C. When you instruct your computer to find the square root of a negative integer. 

Monday, April 15, 2019

Advantages and Disadvantages of 'C' language.

Advantages of C language :

(1) Portability - Program written in C language can be transferred from one machine to another machine. 

(2) Efficiency - program written in C language are fast,efficient and flexible. 

(3) C permits nearly every programming technique like-addressing memory location,manipulation bits etc. 

(4) C is a structure programming language- It allow the use of several programming construct such as sequence construct,selection construct etc. 

(5) Modularity - In C, a given program is divided into a number of module, each of which would perform some specific task. 

Disadvantages of C are:

(1) There is no runtine checking.

(2) There is no strict type checking (for ex:we can pass an integer value for the floting data type). 

(3) As the program extent it is very difficult to fix the bugs. 

Saturday, April 13, 2019

Why C is called Middle Level Language?

C Programming language is called as Middle Level Language because 

(1) It gives or Behaves as High Level Language through Function gives a modular programming and breakup,  increased efficiency for resusabiluty. 

(2) It gives access to the low level memory through pointer. Moreover it does support the Low Level programming I.e, Assembly Language.

As it's a combination of these two aspects, it's neither a High Level nor a Low Level language but a Middle Level Language. 

Thursday, April 11, 2019

Introducing to C language

C is the general purpose computer programming language development in 1972 by Dennis Richie at the Bell Telephone Laboratories for use with the Unix operating system. It was named "C" because many of its features were derived from an earlier language called "B" , which according to Ken Thompson was a stripped - down version of the BCPL programming language.

           Although C was designed for implementing system software. It is also widely used for developing portable application software.

          C  is a one of the most popular programming language. It is widely used on many different software platform, and there are few computer architecture for which a C compiler does not exit. C has greatly influenced many other popular programming language, most notably C++,which originally began as an extension to c.
            C language had become powerful enough that most of the Unix level was rewritten in C. This was one of the first operating system kernels implemented in a language other than assembly. 

Wednesday, April 10, 2019

अन्नदाता की मेहनत

किसान माटी के समृत होते हैं। वे मिट्‌टी से सोना उपजाते हैं। वे अपने श्रम से संसार का पेट भरते हैं। वे अधिक पढ़े-लिखे नहीं होते परंतु उन्हें खेती की बारीकियों का ज्ञान होता है । वे मौसम के बदलते मिजाज को पहचान कर तदनुसार नीति निर्धारित करने में दक्ष होते हैं । सचमुच प्रकृति के सहचर होते हैं हमारे किसान ।


किसानों का मुख्य पेशा कृषि है । पशुपालन उनका सहायक पेशा है । पशु कृषि कार्य में  उनका सहयोग करते हैं । बैल उनका हल और गाड़ी खींचते हैं । गाय उनके लिए दूध, गोबर और बछडे देती है । वे भैंस, बकरी आदि भी पालते हैं जिनसे उन्हें अतिरिक्त आमदनी होती है । इन पालतू पशुओं को पालने में उन्हें विशेष कठिनाई नहीं होती क्योंकि ये कृषि उत्पादों यथा पुआल, भूसा, खली, अनाज खाकर जीवित रहते हैं । पशुओं के लिए घास खेतों और बागानों से उपलब्ध हो जाता है ।
किसान बहुत परिश्रमी होते हैं । वे खेतों में जी-तोड़ श्रम करते हैं । वे मेहनत करके अनाज, फल और सब्जियाँ उगाते हैं । खेतों में फसल उगाने के लिए अच्छी तरह जुते हुए खेतों में बीज डाला जाता है । बीजों में अंकुर निकल आता है और धीरे- धीरे ये पौधे का रूप ले लेते हैं । पौधों की सिंचाई की जाती है । पौधों के बीच उग आए खर-पतवार निकालकर खेतों में खाद डाला जाता है । आवश्यकता पड़ने पर किसान कीटनाशकों का प्रयोग भी करते हैं ।

To sum n different number using array.

#include<stdio.h> #include<conio.h> Void main()      {          int a[20] n,  s=0,i;          printf("Enter the numbe...