Friday 20 July 2012

42) Write a program to finding the maximum element in an array

#include<conio.h>
#include<iostream.h>
#include<stdio.h>
void main()
{
      clrscr();

    int array[]={1,5,9,6,4};

  int var1=array[0];
  for(int i=1;i<=5;i++)
   {  if(var1<array[i])
       var1=array[i];
   }
  cout<<var1;
       getch();

}

Write a program which reads a set of integers into an integer array and then prints "YES"if all of them are same otherwise print "NO".

#include<stdio.h> int main() { int a[10],M=0,i,n; printf("enter a value for n\n"); scanf("%d",&n); fo...