मराठी

Write a program in C++ to accept 10 integers in an array from keyboard and find largest element of array.

Advertisements

प्रश्न

Write a program in C++ to accept 10 integers in an array from keyboard and find largest element of array. 

कोड लेखन
Advertisements

उत्तर

// Program to find out largest number from the given array 
         #include <iostream.h>
          void main ()
          {
               int num [10], max;
               cout <<"Enter the number";
               for (int i = 0; i < 10; i++)
               cin>>num [i];
               max = num [0];
               for (int j = 1; j < 10; j++)
          {
               if (max < num [j])
               max = num [j];
          }
               cout<<"The largest number in the array is"<<max;
          }
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2023-2024 (March) Official
Advertisements
Share
Notifications



      Forgot password?
Use app×