Basic Programs

If Else based Programs

Loop Based Programs

Array Based Programs

String Programs

Function Programs

Pointers Programs

Structure & File Handling Programs

Data Structure Programs

Array based programs

Program to find the largest elements and its index in an array

 #include<stdio.h>
#include<conio.h>
void main()
{
     int a[10], i=1, maxno=0, maxindex=0;
     printf("enter 10 array elements");
     scanf("%d", &a[0]);
      maxno=a[0];
       while(i<10)
         {
             scanf("%d", &a[i]);
             if(a[i]>maxno)
               {
                  maxno=a[i];
                  maxindex=i; 
                }
             i++;
          }
        printf("max no=%d at position=%d", maxno, maxindex);
}

Output of the above program is as following.

Video/ C Introduction

Watch video in full size
Wordpress Social Share Plugin powered by Ultimatelysocial