Computer Science, asked by abhigyan238632, 1 day ago

oi help me brainly users! here's my question

Write a program to input any number and find out the number of even and odd factors...

i need this question's answer immediately.. please help.. and spammers/other answers will be reported!​

Answers

Answered by thapamampi
0

Answer:

input: n 30

output:24odd dividers sim=1+3+5+24

input:18

output :13

odd dividers sum= 1+3+9=13

Answered by Shivu516
1

Hope it helps ^_^

This program is in Java

Please mark my answer as Brainliest if you think that it's good

import java.util.Scanner;

public class FactorTeller{

   public static void main(String [] args){

       Scanner sc = new Scanner(System.in);

       int i, num;

       System.out.print("Enter a number in order to know its factors: ");

       num = sc.nextInt();

       System.out.println("The factors of the given number are as follows: ");

       for (i = 1; i <= num; i++){

           if(num % i == 0){

               System.out.println(i);  

           }

       }

   }

}

Output:

Enter a number in order to know its factors: 36

The factors of the given number are as follows:  

1

2

3

4

6

9

12

18

36

Similar questions