World Languages, asked by bondgeavidya08, 19 days ago


is the founder of Event Management Company. Sparsh Services". In th the
financial transactions are carried out online and Varun has strictly insis aff to
do any transactions on web browsers that supports AES encryption m number
is an AES number if it has exactly four divisors. In other words, ther exactly
four numbers that divide into it evenly. For example 10 is an AES num
because it has exactly four divisors (1 25:10). 12 is not an AES number beca
too many divisors (1. 2. 3. 4.6. 12). 11 is not an AES number either. There is on
AES number in the range 10...12.
6 Numbers
Given a range of numbers, write a program that counts how many numbers
fro range are AES numbers.​

Answers

Answered by tenzinyarphel5136
3

Answer:

#include<iostream>

using namespace std;

int main()

{

int lb,ub,count,aes_count=0;

cin>>lb;

cin>>ub;

while(lb<=ub)

{

 count=0;

 for(int i=1;i<=lb;i++)

 {

  if(lb%i==0)

  {

   count++;

  }

 }

 if(count==4)

 {

  aes_count++;

 }

    lb++;

}

cout<<aes_count;

}

Explanation:

Answered by sadiaanam
0

Answer:

To write a program that counts how many numbers from a given range are AES numbers, we need to iterate over each number in the range and check if it has exactly four divisors. Here's one way to implement this program in Python:

def is_aes(num):

   """

   Returns True if the given number is an AES number (i.e., has exactly four divisors)

   """

   count = 0

   for i in range(1, int(num ** 0.5) + 1):

       if num % i == 0:

           count += 1

           if num // i != i:

               count += 1

       if count > 4:

           return False

   return count == 4

def count_aes_numbers(start, end):

   """

   Counts the number of AES numbers in the given range of numbers (inclusive)

   """

   count = 0

   for num in range(start, end+1):

       if is_aes(num):

           count += 1

   return count

The is_aes function checks if a given number is an AES number by counting the number of divisors it has. It iterates over all the numbers up to the square root of the given number, and increments the count for each factor it finds. If the count ever exceeds 4, the function returns False. Otherwise, it returns True if the count is exactly 4.

The count_aes_numbers function iterates over each number in the given range (inclusive), and calls the is_aes function to check if it's an AES number. If it is, it increments the count. Finally, it returns the total count of AES numbers found in the range.

Using this program, we can count the number of AES numbers in any given range of numbers by calling the count_aes_numbers function with the starting and ending values of the range.

Learn more about Python :

https://brainly.in/question/18675738

#SPJ3

Similar questions