Saturday, 6 September 2014

C Program to print the first N Natural Numbers in Reverse Order

Program:

#include<stdio.h>
#include<conio.h>
void main( )
{
             int c,n;
             printf("\nEnter N value: ");
             scanf("%d", &n);
             c = n;
             while(c>0)
             {
                      printf("\n %d",c);
                      c--;
              }
              getch( );
}

Input/Output:

Enter N Value: 5
5
4
3
2
1



C Program to Print the first N Natural Numbers

Program:

#include<stdio.h>
#include<conio.h>
void main( )
{
           int c=1,n;
           printf("\n Enter N value: ");
           scanf("%d", &n);
           while(c<=n)
           {
                    printf("\n %d",c);
                    c++;
            }
            getch( );
}

Input/Output:

Enter N value: 5
1
2
3
4
5

C Program to print the given message N times


Program:

#include<stdio.h>
#include<conio.h>
typedef int count;
void main( )
{
            count c = 1,n;
            printf("\n Enter N value: ");
            scanf("%d", &n);
            A: printf("\n Let US Code in C");
                 c++;
                 if( c<=n)
                      goto A;
             getch();
}

Input/Output:

Enter N value: 5

Let US Code in C

Let US Code in C

Let US Code in C

Let US Code in C

Let US Code in C

C language Tutorials-1



--> 1 Byte  =  8 bits

--> 1 Kilo Byte  =  2^10 Bytes = 1024 bytes

--> 1 Mega byte = 2^10 KB = (2^10)*(2^10) bytes = 2^20 bytes

--> 1 Giga Byte = 2^10 MB = (2^10)*(2^10)*(2^10) bytes = 2^30 bytes

--> A variable just storage a location which is capable of storage some table.

-->The rules for naming a variable are else following.

--> The Variable name should start with
         1) Alphabets and it can be followed by any number of  alphabets or digits without any other                     special symbols except "___"(underscore).
        2) The Variable names should not match with the keywords
        3) Variable names should be unique i.e , no two variables should have same name within a program.
--> There are some words provided by "C" language which has a free defined meaning and are referred as key words (or) reserved words
-->  There are 32 Keywords in C language. The keywords provided by "C" languages are as follows

             Auto, break, case, char, const, continue, do, default, double, else, enum, extern, far, for, float, goto, int, if, long, near, return, register, struct, static, short, signed, switch, typedef, union, unsigned, void, while


--> "C" language is a case-sensitive language i.e, it consider both upper case and lower case symbols are different.

--> A program is set of sequence of instruction which perform a free defined task.

--> Each and Every statement should be terminated with a semicolon(;).

--> A "C" Program is a combination of functions with a special function called main()  from which they execution start
        ( ) --> Parenthesis
       { } --> Braces
        [ ] --> Sub-script
   
For Example:
                      main( )
                     {
                             f(3);
                             f(2);
                             f(1);
                      }
                      f1(arg list)
                      {
                               statements;
                      }
                      f2(arg list)
                      {
                                statements;
                      }
                      f3(arg list)
                      {
                                statements
                      }