write a c program to input a number and print all its divisors using while loop.

View Answers

November 23, 2010 at 3:05 PM

Hi Friend,

Try the following code:

#include<stdio.h> #include<conio.h> void main() { int i,n; clrscr(); ptintf("\n Enter Number: \n"); scanf("%d",&n); for(i=2;i<=n;i++){ if(n%i==0){ printf("\t %d",i); n=n/i; i--; } } getch(); }

Thanks

Related Tutorials/Questions & Answers:

finding divisors of a number write a c program to input a number and print all its divisors using while loop

finding divisors of a number write a c program to input a number and print all its divisors using while loop

Advertisements

finding divisors of a number write a c program to input a number and print all its divisors using while loop

servlet code for finding the table for given number servlet code for finding the table for given number? Here is a an example that accepts a number from the user and display its multiplication table using servlet. 1

Finding A Date My Frequency Start Date is 24-08-2012 My frequency end date - not defined Calculation Frequency is Weekly(Sunday) My calculation will be from 24-08-2012 to the following sunday My question is how to find

Java : Square root of any number In this section we will write code for finding square root of any number without using system methods. Square root : It is number when we square it, find the specified number. There is simplest way

finding the prime numbers Hi, I am a beginner to java and I have problem with the code in finding the prime numbers, can someone tell me about... number is prime or not, follow the link and it will provide you in depth knowledge

finding java code on internet Is there anybody to help me? i want to some java coding web sites.it is prerequest for me

How to Check Perfect Number in Java Program A perfect number is a positive integer where the sum of all its positive divisors, except itself, is equal to the number itself. For example 6 is a perfect number as 1,2 and3 are its divisors

perfect number An integer number is said to be a perfect number.... For example, 6 is a perfect number because 6 = 1+2+3. Write a method perfect that determines if parameter number is a perfect number. Use this method

prime number could u pls help me out in finding whether a number is a prime number or not? import java.util.*; class CheckPrimeNumber { static boolean isPrime(int number){ boolean isPrime=false

prime number get one number and check the number prime or not using if statement Java Check Prime Number

ModuleNotFoundError: No module named 'word-finding' Hi, My Python... 'word-finding' How to remove the ModuleNotFoundError: No module named 'word-finding' error? Thanks Hi, In your python

Finding duplicates using array in for loop how to find the duplicates in array using for loop

the number of parameters How do I find out the number of parameters passed into function

Number in array How to write a program to check the number that we are entered from keyboard is in the given array

Finding searching phrase of a search engine how to find out searching phrase of a search engine..? like, if visitors enter the keyword to google, is is any possible to get that keyword

Finding smallest value, then the next etc hi, I know how to search for the smallest value index in an unsorted array so far with this: double currentValue = dist[0]; int smallestIndex = 0; for (int j

Finding page count in any file Hi, I want to find out the page count in any file (doc,ppt,pdf,image,etc...). Is there any universal API to deal with any file irrespective of the file extension.Its bit urgent. Please let me

Finding shapes in digital photos - java Hello, I need some hints/tips regarding some project I'm doing. The project is about finding shapes in digital photos (JPEG file). Here's what I have to do: A digital photo

Location finding error Location needs from drive name: My file uploading program has an error. It requires the location should be given from the directory name. Instead of this if only parent directory is given it shows

prime number To check a number entered by user is prime or not? Java check prime number import java.util.*; class CheckPrimeNumber { static boolean isPrime(int number){ boolean isPrime=false

prime number to check wethere given number is prime or not? ... { static boolean isPrime(int number){ boolean isPrime=false; int i=(int) Math.ceil(Math.sqrt(number)); while (i>1

prime number HI!I want a java program that accepts a number from user and displays whether it is a prime number or not using BufferedReader

Count number of "*" I have this code to count the number of * from a string entered. but I need to find it from an text file. Any idea? import...++; } } System.out.println("The number of vowels in the given sentence

Number Pyramid Hi Everyone, Can someone help me write the code for the following number pyramid: print... 0 0 0 0 4 ... "); There is 5 spaces in between each number

number sorting program to sort a list of numbers in descending order where the inputs are entered from keyboard in runtime Hi Friend, Try the following code:ADS_TO_REPLACE_1 import java.util.*; class

random number Please How do I generate a program that gives me random integer from 115 to 250? Using java.util.random. Thank you very much! Hi Friend, Try the following code:ADS_TO_REPLACE_1 import java.util.

number pyramid how to get the code for the following : 1 123 12345 1234567 class Pyramid{ public static void main(String args[]){ for(int i=1;i<=7

Primary number write a program to find the 100th or nth primary number? import java.util.*; class PrimeNumber{ public static void main(String a[]) { Scanner input=new Scanner(System.in

Primary number write a program to find the 100th or nth primary number? import java.util.*; class PrimeNumber{ public static void main(String a[]) { Scanner input=new Scanner(System.in

finding the eigenvalues and eigenvector of n*n matrix in java Here...[][] {{4,3,1,2},{1,1,1,1},{1,2,1,1},{1,1,1,1} }; double t, c, s; int p, q, icount... icmax = 10; // the maximum iterations number int[] colRowOfElMax = new int[size

VoIP Number VoIP Numbers With a VoIPtalk Incoming number, callers can reach you by calling a UK number no matter where you are, Simply plug... connection and anyone can reach you by dialling your individual number. The VoIPtalk

Finding memory consuming process Hi, While debugging or optimizing your java application, how to find the memory consuming processes? Thanks

Finding all palindrome prime numbers How do i write a program to Find all palindrome prime numbers between two integers supplied as input (start and end points are excluded

i need a java code for finding typemismatch in an editor. hi im sriram, i need a java code in such a way that typemismatch code is embedded with the simple java editor. the sample output is shown below !alt text

Finding the longest word in a user given string In java, accept a string from the user and find the longest word in it. The given code finds the longest word from the string. import java.util.*; class LongestWord

Example for Finding the Root Element in the XML File In this tutorial, we will discuss about how to find the Root Element in the XML file. The XML DOM views an XML document as a tree-structure. Contents can be updated or deleted. You

to read number from user 1)print the positive equivalent of the number 2) check if the no is integer or not 3) find the square root of the number 4) find the cube of the number

NUMBER OF VOWELS IN A WORD WRITE A PROGRAM THAT WILL INPUT A WORD THEN IT WILL DETERMINE THE NUMBER OF VOWELS PRESENT IN THE INPUTTED WORD

using random number generate a 10 digit number using random number and display the length of longest increasing series

To check a palindrome number? program to check a number is palindrome or not using recursion?(wihout converting to string

Using JSTL For Finding Square In this program we... are taking to finding out the square is the JSTL. We are using the <c

Ads