Computer Science, asked by dikshajain18, 1 month ago

wap to input 8 no.s in an integer array and print those no.s whose last digit is perfect no.

wap to input 10 numbers in an array and print the frequency of each number

Answers

Answered by ohmkardebnath
1

Answer:

I'm using C to write program

main()

int num[10], i;

for(i=0, i<10, i++)

scanf("%d",&num[i]);

getch();

return 0;

Answered by amarjyotijyoti87
0

Explanation:

#include <iostream> using namespace std; bool is_Perfect(long long int n) {     long long int sum = 1;     for (long long int i=2; i*i<=n; i++)     {         if (n%i==0)         {             if(i*i!=n)                 sum = sum + i + n/i;             else                 sum=sum+i;         }     }      if (sum == n && n != 1)           return true;         return false; } int main(){     int n, perfect[8], size = 0;     cout<<"Input the 8 numbers;\n";     for(int i = 0; i < 8; i++){         cin>>n;         if(is_Perfect(n)){             perfect[i] = n;             size++;         }     }     if(size == 0) cout<<"No perfect numbers found!";     else{         cout<<"Perfect numbers: ";         for(int i = 0; i < size; i++) cout<<perfect[i]<<" ";     }     return 0; }

Similar questions