Saturday, September 24, 2016

HTML- Image

<html>
<body>

<img src="E://fantastic/funny_apple.jpg" width="1200" height="1000">
</body>
</html>

HTML- Link

<html>
<body>

<a href="http://www.google.com">
This is a link</a>

</body>
</html>

HTML-Frames

<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE>HTML FRAMES</TITLE>
</HEAD>
<FRAMESET cols="33%, 33%, 34%" frameborder="1">
<FRAME NAME="TOP" SRC="E://Siddhant/HTML/Google/login1.html" noresize="noresize"/>
<FRAME NAME="MAIN" SRC="file:///E:/Siddhant/HTML/GOOGLE/search.html" noresize="noresize"/>
<FRAME NAME="BOTTOM" SRC="file:///E:/Siddhant/HTML/GOOGLE/signup.html" noresize="noresize"/>
<NOFRAMES>
<BODY>
YOUR BROWSER DOES NOT SUPPORT FRAMES.
</BODY>
</NOFRAMES>
</FRAMESET>
</HTML>

HTML- Forms

<html>
<body>

<form action="">
First name: <input type="text" name="firstname"><br>
Last name: <input type="text" name="lastname">
</form>

<p><b>Note:</b> The form itself is not visible. Also note that the default width of a text field is 20 characters.</p>

</body>
</html>

HTML- Change Text

<!DOCTYPE html>
<html>
<body>

<h1>What Can JavaScript Do?</h1>

<p id="demo">JavaScript can change HTML content.</p>

<button type="button"
onclick="document.getElementById('demo').innerHTML = 'Hello JavaScript!'">
Click Me!</button>

</body>
</html>

HTML- Change Text Format

<!DOCTYPE html>
<html>
<body>

<h1>What Can JavaScript Do?</h1>

<p id="demo">JavaScript can change the style of an HTML element.</p>

<script>
function myFunction() {
    var x = document.getElementById("demo");
    x.style.fontSize = "25px";          
    x.style.color = "red";
}
</script>

<button type="button" onclick="myFunction()">Click Me!</button>

</body>
</html>

HTML- Change Image on Mouse Click

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Can Change Images</h1>

<img id="myImage" onclick="changeImage()" src="pic_bulboff.gif" width="100" height="180">

<p>Click the light bulb to turn on/off the light.</p>

<script>
function changeImage() {
    var image = document.getElementById('myImage');
    if (image.src.match("bulbon")) {
        image.src = "pic_bulboff.gif";
    } else {
        image.src = "pic_bulbon.gif";
    }
}
</script>

</body>
</html>

HTML- Using Different Tags

<!doctype html>
<html>
<head>
<title>My First HTML Document</title>
</head>
<body bgcolor="orange">
<center>
<h1>First Document</h1>
<img src="E://Siddhant/Images/All Star.jpg" width="200" height="100" alternate="All Star"/>
</center>
<marquee behaviour="alternate"><p>This is my <em>first</em> html document</p></marquee>
<center>
<p>I am <strong>learning</strong> html programming</p>
<p><b>Using pre tag-</b></p>
<pre>
            *
           ***
          *****
           ***
            *
</pre>
</center>
<p><b>Using address tag-</b></p>
<address>
House No 22/7<br/>
Madar Darwaza<br/>
Auraiya</br>
PIN 206122<br/>
Uttar Pradesh
</address>
<p>2<sup>2</sup>=4</p>
<p><b><i>Brought to you by-</i></b></p><br/>
Cremica<sub>2</sub>
<p><abbr title="Lovely Professional University">LPU</abbr></p>
<p><acronym title="Aam Aadmi Party">AAP</acronym></p>
</body>
</html>

HTML- Validate Input

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Can Validate Input</h1>

<p>Please input a number between 1 and 10:</p>

<input id="numb" type="number">

<button type="button" onclick="myFunction()">Submit</button>

<p id="demo"></p>

<script>
function myFunction() {
    var x, text;

    // Get the value of the input field with id="numb"
    x = document.getElementById("numb").value;

    // If x is Not a Number or less than one or greater than 10
    if (isNaN(x) || x < 1 || x > 10) {
        text = "Input not valid";
    } else {
        text = "Input OK";
    }
    document.getElementById("demo").innerHTML = text;
}
</script>

</body>
</html>

HTML- Table

<!doctype html>
<html>
<head>
<title>tables.org</title>

</head>
<body>
<h1>STUDENT DATA</h1>
<table border="1" cellspacing="2" cellpadding="2" width="1000">
<thead>
<tr>
<td>REG NO</td>
<td>NAME</td>
<td>CGPA</td>
</tr>
<tbody>
<tr>
<td>1129</td>
<td>Pallavi</td>
<td>9.90</td>
</tr>
<tr>
<td>1130</td>
<td>Ajay</td>
<td>9.80</td>
</tr>
<tr>
<td>1145</td>
<td>Mahesh</td>
<td>9.76</td>
</tr>
<tr>
<td>1189</td>
<td>Indrajeet</td>

Matlab- Factorial

ch='y';
while ch~='n'
n=input('Pick a number:\n');
fact=zeros(1,n+1);
fact(1)=1;
fact(2)=1;
k=2;
while k<=n
    fact(k+1)=k*fact(k);
    k=k+1;
end
fprintf('factorial of %d is\n',n);
fprintf('%g\n',fact(n+1));
ch=input('Do you want fo continue: ');
end

Friday, September 23, 2016

Download Dev-C++

Bloodshed Dev-C++ is a full-featured Integrated Development Environment (IDE) for the C/C++ programming language. It uses Mingw port of GCC (GNU Compiler Collection) as it's compiler. Dev-C++ can also be used in combination with Cygwin or any other GCC based compiler.

Features are :

- Support GCC-based compilers
- Integrated debugging (using GDB)
- Project Manager
- Customizable syntax highlighting editor
- Class Browser
- Code Completion
- Function listing
- Profiling support
- Quickly create Windows, console, static libraries and DLLs
- Support of templates for creating your own project types
- Makefile creation
- Edit and compile Resource files
- Tool Manager
- Print support
- Find and replace facilities
- CVS support


C++ Armstrong Number



   # include <iostream>
   # include <conio.h>
   # include <math.h>
   using namespace std;
   int main ()
   {
     
     int a,b=0,sum=0;
     long int n;
     cout<<"Enter the NO. : ";
     cin>>n;
     for(;n>0;)
     //counts the digits
     {
       a=n%10;
       n=n/10;
       b++;
     }
     for(;n>0;)
     {
       a=n%10;
       sum=sum+pow(a,b);
       n=n/10;
     }
     if(sum==n)
     {
       cout<<"IT IS AN ARMSTRONG NUMBER...";
       getch();
     }
     else
     {
       cout<<"IT IS NOT AN ARMSTRONG NUMBER...";
       getch();
     }
   }

Data structures- doubly linked lists

#include<iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;
struct node
{
    int info;
    node *prev;
    node *next;
};
int main()
{
    char ch;
   struct node *start= NULL;
    struct node *save, *last;
    struct node *new_node;
   
    do
    {
        new_node=(node *)malloc(sizeof(node));
        cout<<"\nEnter info"<<endl;
        cin>>new_node->info;
    if(start==NULL)
    {
        new_node->prev=NULL;
        new_node->next=NULL;
        start=new_node;
        last = start;
    }
    else
    {
            save=start;
        new_node->next=save;
            new_node->prev=NULL;
        save->prev=new_node;
        start=new_node;
    }
     printf("\nDo you want to create another : (y/n))");
        ch=getche();
   }while(ch!='n');
    cout<<endl<<"Display using next pointer"<<endl;
    while(new_node!=NULL)
    {
        cout<<new_node->info<<"->";

    new_node = new_node->next;
    }
    cout<<"NULL\n";
    new_node = last;
     cout<<endl<<"Display using prev pointer"<<endl;
     cout<<"NULL";
while(new_node!=NULL)
    {
        cout<<"<-"<<new_node->info;
     new_node=new_node->prev;
    }
  
getch();
return 0;
}

Data structures- queue

#include<iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;
int n;
class queue
{
    int *data,front,rear;
    public:
        queue()
        {
            cout<<"Enter the max size of queue\n";
            cin>>n;
            cout<<endl;
            data= new int[n];
            front=0;
            rear=0;
        }
        void print()
        {
            if(front==0 && rear==0)
            {
                cout<<"Queue is empty\n";
            }
            for(int i=front;i<=rear;i++)
            {
                cout<<data[i]<<"\t";
            }
        }
        void input(int item)
        {
            if(rear==n-1)
            {
                cout<<"Queue overflow\n";
            }
            rear=rear+1;
            data[rear]=item;
            if(front==0)
            front=1;
        }
        int Delete()
        {
            if(front==n-1 || front==rear)
            {
                front=rear=0;
            }
            else
            {
               front=front+1;
               int item=data[front];
               return item;
            }
        }
   
};
int main()
{
    class queue q;
    int item;
    for(int i=0;i<n;i++)
    {
        cout<<"\nEnter item to be inserted\n";
        cin>>item;
        q.input(item);
    }
    q.print();
    getch();
    return 0;
}

   
           

Data structures- quick sort

#include <iostream>
using namespace std;

const int INPUT_SIZE = 10;

// A simple print function
void print(int *input)
{
    for ( int i = 0; i < INPUT_SIZE; i++ )
        cout << input[i] << " ";
    cout << endl;
}

// The partition function
int partition(int* input, int p, int r)
{
    int pivot = input[r];

    while ( p < r )
    {
        while ( input[p] < pivot )
            p++;

        while ( input[r] > pivot )
            r--;

        if ( input[p] == input[r] )
            p++;
        else if ( p < r )
        {
            int tmp = input[p];
            input[p] = input[r];
            input[r] = tmp;
        }
    }

    return r;
}

// The quicksort recursive function
void quicksort(int* input, int p, int r)
{
    if ( p < r )
    {
        int j = partition(input, p, r);       
        quicksort(input, p, j-1);
        quicksort(input, j+1, r);
    }
}

int main()
{
    int input[INPUT_SIZE];
    for(int i=0;i<INPUT_SIZE;i++)
    {
        cin>>input[i];
    }
    cout << "Input: ";
    print(input);
    quicksort(input, 0, 9);
    cout << "Output: ";
    print(input);
    return 0;
}

Data structures- stack from queue


#include<stdio.h>
#include<iostream>
#include<conio.h>
using namespace std;
struct queue1
{
    queue1 *next1;
    int data1;
}*front1 = NULL, *rear1 = NULL, *q1 = NULL, *p1 = NULL, *np1 = NULL;
struct queue2
{
    queue2 *next2;
    int data2;
}*front2 = NULL, *rear2 = NULL, *q2 = NULL, *p2 = NULL, *np2 = NULL;
void enqueue1(int x)
{    
    np1 = new queue1;
    np1->data1 = x;
    np1->next1 = NULL;
    if (front1 == NULL)
    {
        rear1 = np1;
        rear1->next1 = NULL;
        front1 = rear1;
    }
    else
    {
        rear1->next1 = np1;
        rear1 = np1;
        rear1->next1 = NULL;
    }
}
int dequeue1()
{
    int x;
    if (front1 == NULL)
    {
        cout<<"no elements present in queue\n";
    }
    else
    {
        q1 = front1;
        front1 = front1->next1;
        x = q1->data1;
        delete(q1);
        return x;
    }
}
void enqueue2(int x)
{
    np2 = new queue2;
    np2->data2 = x;
    np2->next2 = NULL;
    if (front2 == NULL)
    {
        rear2 = np2;
        rear2->next2 = NULL;
        front2=rear2;
    }
    else
    {
        rear2->next2 = np2;
        rear2 = np2;
        rear2->next2 = NULL;
    }
}
int dequeue2()
{
    int x;
    if (front2 == NULL)
    {
        cout<<"no elements present in queue\n";
    }
    else
    {
        q2 = front2;
        front2 = front2->next2;
        x = q2->data2;
        delete(q2);
        return x;
    }
}       
int main()
{
    int n, x, i = 0;
    cout<<"Enter the number of elements to be entered into stack\n";
    cin>>n;
    while (i < n)
    {
        cout<<"enter the element to be entered\n";
        cin>>x;
        enqueue1(x);
        i++;
    }
    cout<<"\n\nElements popped\n\n";
    while (front1 != NULL || front2 != NULL)
    {
        if (front2 == NULL)
        {
            while (front1->next1 != NULL)
            {
                enqueue2(dequeue1());
            }
            cout<<dequeue1()<<endl;
        }
        else if (front1 == NULL)
        {
            while (front2->next2 != NULL)
            {
                enqueue1(dequeue2());
            }
            cout<<dequeue2()<<endl;
        }
    }
    getch();
}

Data structures- skiplist

#include<iostream>
#include<cstdlib>
#include<cmath>
#include<cstring>
#define MAX_LEVEL 6
const float P=0.5;
using namespace std;
/* Skip Node Declaratiom */
struct snode
{
    int value;
    snode **forw;
    snode(int level, int &value)
    {
        forw= new snode *[level+1];
        memset(forw,'0', sizeof(snode)*(level+1));
        this->value=value;
    }
    ~snode()
    {
        delete []forw;
    }
};
/* Skip List Declaration */
struct skiplist
{
    snode *header;
    int value;
    int level;
    skiplist()
    {
        header=new snode(MAX_LEVEL, value);
        level=0;
    }
    ~skiplist()
    {
        delete header;
    }
    void display();
    bool contains(int &);
    void insert_element(int &);
    void delete_element(int &);
};
/* Main: COntains Menu */
int main()
{
    skiplist ss;
    int choice, n;
    while(1)
    {
        cout<<endl<<"------------"<<endl;
        cout<<endl<<"Operations on Skip List"<<endl;
        cout<<endl<<"------------"<<endl;
        cout<<"1. Insert Element"<<endl;
        cout<<"2. Delete Element"<<endl;
        cout<<"3. Search Element"<<endl;
        cout<<"4. Display List"<<endl;
        cout<<"5. Exit"<<endl;
        cout<<"Enter your choice: ";
        cin>>choice;
        switch(choice)
        {
            case 1:
                cout<<"Enter the element to be inserted: ";
                cin>>n;
                ss.insert_element(n);
                if(ss.contains(n))
                cout<<"Element Inserted"<<endl;
                break;
            case 2:
                cout<<"Enter the element to be deleted: ";
                cin>>n;
                if(!ss.contains(n))
                {
                    cout<<"Element not found"<<endl;
                    break;
                }
                ss.delete_element(n);
                if(!ss.contains(n))
                cout<<"Element Deleted"<<endl;
                break;
            case 3:
                cout<<"Enter the element to be searched: ";
                cin>>n;
                if(ss.contains(n))
                cout<<"Element "<<n<<" is in the list"<<endl;
                else
                cout<<"Element not found"<<endl;
            case 4:
                cout<<"The List is: ";
                ss.display();
                break;
            case 5:
                exit(1);
                break;
            default:
                cout<<"Wrong Choice"<<endl;
        }
    }
    return 0;
   
}

Data structures- stack using linked lists

#include<iostream>
#include<cstdlib>
using namespace std;

struct node
{
    int info;
    struct node *link;   
}*top;

class stack_list
{
    public:
        node *push(node *, int);
        node *pop(node *);
        void traverse(node *);
        stack_list()
        {
            top = NULL;
        }              
};

int main()
{
    int choice, item;
    stack_list sl;
    while (1)
    {
        cout<<"\n-------------"<<endl;
        cout<<"Operations on Stack"<<endl;
        cout<<"\n-------------"<<endl;
        cout<<"1.Push Element into the Stack"<<endl;
        cout<<"2.Pop Element from the Stack"<<endl;
        cout<<"3.Traverse the Stack"<<endl;
        cout<<"4.Quit"<<endl;
        cout<<"Enter your Choice: ";
        cin>>choice;
        switch(choice)
        {
        case 1:
            cout<<"Enter value to be pushed into the stack: ";
            cin>>item;
            top = sl.push(top, item);
            break;
        case 2:
            top = sl.pop(top);
            break;
        case 3:
            sl.traverse(top);
            break;
        case 4:
            exit(1);
            break;
        default:
            cout<<"Wrong Choice"<<endl;
        }
    }
    return 0;
}

node *stack_list::push(node *top, int item)
{
    node *tmp;
    tmp = new (struct node);
    tmp->info = item;
    tmp->link = top;
    top = tmp;
    return top;
}

node *stack_list::pop(node *top)
{
    node *tmp;
    if (top == NULL)
        cout<<"Stack is Empty"<<endl;
    else
    {      
        tmp = top;
        cout<<"Element Popped: "<<tmp->info<<endl;
        top = top->link;
        free(tmp);
    }
    return top;
}

void stack_list::traverse(node *top)
{      
    node *ptr;
    ptr = top;
    if (top == NULL)
        cout<<"Stack is empty"<<endl;
    else
    {
        cout<<"Stack elements :"<<endl;
        while (ptr != NULL)
        {
            cout<<ptr->info<<endl;
            ptr = ptr->link;
        }
    }
}

Data structures- stack implementation by array

#include<iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;
int Max;
class stack
{
    int *stk,top;
    public:
        stack()
        {
            cout<<"Enter max size for stack\n";
            cin>>Max;
            stk=new int[Max];
            top=0;
        }
        void print()
        {
            if(top==0)
            {
                cout<<"\nStack is empty\n";
            }
            else
            {
                cout<<"\nStack is\n";
              for(int i=top;i>0;i--)
              {
                    cout<<stk[i]<<"\t";
              }
            }
        }
        void push(int item)
        {
            if(top==Max)
            {
                cout<<"\nStack overflow\n";
            }
            top=top+1;
            stk[top]=item;
        }
        int pop()
        {
            if(top==0)
            {
                cout<<"\nStack underflow\n";
                return '\0';
            }
            return stk[top--];
        }
};
int main()
{
    int item;
    class stack s;
    for(int i=0;i<Max;i++)
    {
        cout<<"\nEnter item to be pushed\n";
        cin>>item;
        s.push(item);
    }
    s.print();
    s.pop();
    getch();
    return 0;
}

Data structures- tower of hanoi

#include <iostream>
#include <conio.h>
using namespace std;
void tower(int a,char from,char aux,char to){
    if(a==1){
       cout<<"\t\tMove disc 1 from "<<from<<" to "<<to<<"\n";
       return;
    }
    else{
       tower(a-1,from,to,aux);
       cout<<"\t\tMove disc "<<a<<" from "<<from<<" to "<<to<<"\n";
       tower(a-1,aux,from,to);
    }
}

int main(){
    
     int n;
     cout<<"\n\t\t*****Tower of Hanoi*****\n";
     cout<<"\t\tEnter number of discs : ";
     cin>>n;
     cout<<"\n\n";
     tower(n,'A','B','C');
     getch();
     return 0;
}

C program for matrix multiplication

#include<iostream.h>
#include<conio.h>
int main()
{
int arr1[20][20],arr2[20][20],result[20][20];
int m,n,i,j;
printf("enter the no. of rows");
scanf("%d",&m);
printf("enter the no. of columns");
scanf("%d",&n);
printf("enter the elements of first matrix \n");
for( i=0;i<m;i++)
{
for(j=0;j<n;j++)
{

scanf("%d",&arr1[i][j]);
}
}
printf("elements of second matrix \n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{

scanf("%d",&arr2[i][j]);
}
}
printf("\n resultant matrix \n");
int k=0;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
result[i][j]=0;
for(k=0;k<m;k++)
{
result[i][j]=result[i][j]+arr1[i][k]*arr2[k][j];
}
}
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
printf("%d\n\t",result[i][j]);
}
printf("\n\n");
}
getch();
}

C program for matrix addition

#include<stdio.h>
#include<conio.h>
int main()
{
int a[2][2],b[2][2];
int i,j;
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("enter elements of martrix A:-\n");
scanf("%d",&a[i][j]);
}
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("enter elements of martrix B:-\n");
scanf("%d",&b[i][j]);
}
}
printf("\nmatrix addition is\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("\t%d",a[i][j]+b[i][j]);
}
printf("\n");
}
getch();
}

C program for linear search in array

#include<stdio.h>
#include<conio.h>
int main(){

    int a[10],i,n,m,c=0;

    printf("Enter the size of an array: ");
    scanf("%d",&n);

    printf("Enter the elements of the array: ");
    for(i=0;i<=n-1;i++){
         scanf("%d",&a[i]);
    }

    printf("Enter the number to be search: ");
    scanf("%d",&m);
    for(i=0;i<=n-1;i++){
         if(a[i]==m){
             c=1;
             break;
         }
    }
    if(c==0)
         printf("The number is not in the list");
    else
         printf("The number is found");
         getch();

}

C program to find largest element of an array

#include<stdio.h>
#include<conio.h>
int main()
{
//int big(int a[],int);
int a[100];
int i,n, large,k,x;
printf("number of elements in the array=");
scanf("%d",&n);
printf("\nenter the elements=");
  for(i=0;i<=n-1;i++)
  {
   scanf("%d",&a[i]);
  }
 
  large=a[0];
  for(i=0;i<=n-1;i++)
   {
    if(large<a[i])
    large=a[i];
   }
   printf(" large=%d\n",large);
getch();
}



Thursday, September 22, 2016

C program for insertion in arrays

#include<stdio.h>
#include<conio.h>
main()
{
      int a[10];
      int n,item,loc;
     
       printf("enter the size of an array:-");
       scanf("%d",&n);
      
       printf("\nenter the elements:-");
       for(int i=0;i<n;i++)
       {
           scanf("%d",&a[i]);   
       } 
      
        printf("\nenter the element you want to insert:-");
       scanf("%d",&item);
      
       printf("\nenter the location:-");
       scanf("%d",&loc);
      
       for(int i=n-1;i>=loc-1;i--)
             {
               a[i+1]=a[i];
       }
       a[loc-1]=item;
      
       printf("\narray after inserting element is:-");
       for(int i=0;i<n+1;i++)
       {
           printf("%d\n",a[i]);   
       } 
       getch();
}

C program- sum of even and odd positions in array

#include<stdio.h>
#include<conio.h>
int main()
{
int arr[5],a=0,s=0,i;
for(i=0;i<5;i++)
{
printf("enter no");
scanf("%d",&arr[i]);
}
for(i=0;i<5;i++)
{
if(arr[i]%2==0)
{
a=a+arr[i];
}
else
{
s=s+arr[i];
}
}
printf("sum of even numbers is%d\n",a);
printf("sum of odd numbers is%d\n",s);
getch();
}

C program for deletion in arrays

#include<stdio.h>
#include<conio.h>
main()
{
      int a[10];
      int n,loc;
     
       printf("enter the size of an array:-");
       scanf("%d",&n);
      
       printf("\nenter the elements:-");
       for(int i=0;i<n;i++)
       {
           scanf("%d",&a[i]);   
       } 
      
       printf("\nenter the postion of the element you want to delete:-");
       scanf("%d",&loc);
      
       if(loc >= n+1 )
       printf("\nDeletion not possible.\n");
     
      else
      {
          for(int i=loc-1;i<n-1;i++)
          {
                  a[i]=a[i+1];
          }
         
      }
        printf("\narray after deleting element is:-");
       for(int i=0;i<n-1;i++)
       {
           printf("%d\n",a[i]);   
       } 
      
      
      
       getch();
}

C program for use of arrays in functions

#include<stdio.h>
#include<conio.h>
int main()
{
int big(int a[],int);
int a[100];
int i,n, large,k;
printf("number of elements in the array=");
scanf("%d",&n);
printf("\nenter the elements=");
for(i=0;i<=n-1;i++)
{
scanf("%d",&a[i]);
}
printf("contents of array\n=");
for(i=0;i<=n-1;i++)
{
printf("%d",a[i]);
printf("\n");
}
big(a,n);
//printf("\nlargest element is");
getch();
}
int big(int x[],int p)
{
int i,large;
large=x[0];
for(i=0;i<=p-1;i++)
{
if(large<x[i])
large=x[i];
}
printf(" large=%d\n",large);
}



2D Arrays in C

#include<stdio.h>
#include<conio.h>
int main()
{
int arr[3][2];
int i,j;
for(i=0;i<3;i++)
{
for(j=0;j<2;j++)
{
printf("enter the number\n");
scanf("%d",&arr[i][j]);
}
}
for(i=0;i<3;i++)
{
for(j=0;j<2;j++)
{
printf("%d ",arr[i][j]);
}
printf("\n");
}
getch();
}

Arrays in C- Creation,Input and Print

#include<stdio.h>
#include<conio.h>
int main()
{
    int a[5];
    int i;
printf("enter the number of elements");
    for(i=4;i>=0;i--)
    {
    scanf("%d",&a[i]);
    //printf("\n%d",a[i]);
}
printf("the elements are");
    for(i=0;i<5;i++)
    {
  
    printf("\n%d",a[i]);
}
    getch();
}