read a number & print all its devisors using c-program?

Answer Posted / vclingisetty@gmail.com

#include<stdio.h>
#include<conio.h>
void main()
{
int n,i;
clrscr();
printf("enter a number\n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(n%i==0)
printf("%d",i);
}
getch();
}

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.

830


Can 'this' pointer by used in the constructor?

608


What does the c in ctime mean?

561


To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9

2182


write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.

1979






What is the g value paradox?

641


What is string function in c?

531


What are pragmas and what are they good for?

567


What is the correct code to have following output in c using nested for loop?

609


Are the variables argc and argv are always local to main?

569


Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

599


What are the uses of a pointer?

675


What is the difference between malloc() and calloc()?

613


Write a factorial program using C.

637


How is a macro different from a function?

652