HTML Tutorial || Networking Assignment || Computer Full Forms || Ms-Office Shortcut Keys || Ms-Office Notes || Number System Notes || Internet Assignment
JavaScript Tutorial || CSS Tutorial || Operating System Notes || History of Computer Assignment || Netwoking Notes || Computer Fundamentals Notes

C program to Input an Array of 5 Elements and Find Maximum Elements ?


Q:- Write a C program to Input an Array of 5 Elements and Find Maximum Elements ?
            #include<stdio.h>
            #include<conio.h>
            main()
    {
int a[5],max=-32768,i;
clrscr();
printf(“Entr 5 Elements =”);
for(i=0;i<5;i++)
{
scanf(“%d”,&a[i]);
if(a[i]>max)
max=a[i];
}
printf(“Maximum Element =%d”,max);
getch();
      }




C program to Input an Array of n Elements & Print the Reverse of all Elements ?


Q:- Write a C program to Input  an Array of n Elements & Print the Reverse of all
       Elements ?
            #include<stdio.h>
            #include<conio.h>
            main()
     {
int a[100],num,i,j;
clrscr();
printf(“Enter Limit of Array =”);
scanf(“%d”,&a[i]);
printf(“Enter Array Elements\n”);
for(i=0;i<num;i++)
{
scanf(“%d”,&a[i]);
}
printf(“\n Reverse of all Array Elmeents \n”);
for(i=num-1;i>=0;i--)
printf(“%d\n”,a[i]);
getch();
      }



C program to Find Sum of all Elements in an Array ?


Q:- Write a C program to Find Sum of all Elements in an Array ?
            #include<stdio.h>
            #include<conio.h>
            main()
   {
int a[5],I,s=0;
clrscr();
printf(“Enter 5 Elements =”);
for(i=0;i<7;i++)
{
scanf(“%d”,&a[i]);
s=s+a[i];
}
printf(“Sum of all Elements =%d”,s);
getch();
      }



C program to Input an Array of 7 Elemnts & Copy into Another Array only Odd Elements ?


Q:- Write a C program to Input an Array of 7 Elemnts & Copy into Another Array only
       Odd Elements ?
            #include<stdio.h>
            #include<conio.h>
            main()
  {
int a[7],b[7],i,j;
clrscr();
printf(“Enter 7 Elements =”);
for(i=0;i<7;i++)
scanf(“%d”,&a[i]);
i--;
for(j=6;j>=0;j--)
{
a[i] % 2!=0
b[j]=a[i];
i--;
}
printf(“Elements of Array B are \n”);
for(j=0;j<7;j++)
printf(“%d”,b[j]);
getch();
      }



C program to Input an Array of 7 Elements & Copy the Contents of One Array into Another Array ?


Q:- Write a C program to Input an Array of 7 Elements & Copy the Contents of One
        Array into Another Array ?
            #include<stdio.h>
            #include<conio.h>
            main()
     {
int a[7],b[7],I;
clrscr();
printf(“Enter 7 Elements =”);
for(i=0;i<7;i++)
{
scanf(“%d”,&a[i]);
b[i]=a[i];
}
printf(“\n Elements of Array B are \n”);
for(i=0;i<7;i++)
printf(“%d\n”,b[i]);
getch();
      }



C program to Input an Array of 7 Elemnts and Copy the Contents of One Array into Another Array in Reverse Order ?


Q:- Write a C program to Input an Array of 7 Elemnts and Copy the Contents of One
        Array into Another Array in Reverse Order ?
            #include<stdio.h>
            #include<conio.h>
            main()
    {
int a[7],b[7],i,j;
clrscr();
printf(“Enter 7 Elements =”);
for(i=0;i<7;i+)
scanf(“%d”,&a[i]);
i--;
for(j=0;j<7;j++)
{
b[j]=a[i];
i--;
}
printf(“\n Array of Elements B are \n”);
for(j=0;j<7;j++)
printf(“%d\n”,b[i]);
getch();
     }




C program to Input an Array of 5 Elements and Print Only Odd Elements on Screen ?


Q:- Write a C program to Input an Array of 5 Elements and Print Only Odd Elements
        on Screen ?
            #include<stdio.h>
            #include<conio.h>
            main()
     {
int a[5],I;
clrscr();
printf(“Enter a Number =”);
for(i=0;i<5;i++)
{
scanf(“%d”,&a[i]);
}
for(i=0;i<=5;i++)
if(a[i] % 2!=0)
{
printf(“%d\n”,a[i]);
}
getch();
      }




C program to Input an Array of 5 Elements & Print the Elements in Reverse Order ?


Q:- Write a C program to Input an Array of 5 Elements & Print the Elements in
       Reverse Order ?
            #include<stdio.h>
            #include<conio.h>
            main()
    {
int a[5],i;
clrscr();
printf(“Enter 5 Elements =”);
for(i=0;i<=4;i++)
{
scanf(“%d”,&a[i]);
}
printf(“\n\n Elements are in Reverse Order \n\n”);
for(i=4;i>=0;i--)
{
printf(“%d\n”,a[i]);
}
getch();
       }