Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write an interactive program to generate the divisors of a
given integer.

Answer Posted / pradeep

same program as above, optimising it a little bit.

#include<stdio.h>
int main()
{
int n,i=1;
printf("Value for n\n");
scanf("%d\n",&n);
while(i <= n/2)
{
if(n%i == 0)
printf("%d\n",i);

i++;
}
printf("%d\n",n);
}

Is This Answer Correct ?    2 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why main is not a keyword in c?

1185


What is the difference between procedural and functional programming?

1019


Is there any demerits of using pointer?

1022


Write a program to swap two numbers without using a temporary variable?

1079


Write a program to print numbers from 1 to 100 without using loop in c?

1033


What is the general form of a C program?

981


Is it acceptable to declare/define a variable in a c header?

1065


Is there a built-in function in C that can be used for sorting data?

1190


I have seen function declarations that look like this

999


Explain pointer. What are function pointers in C?

1021


Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays

2304


What is scope of variable in c?

1001


Why c language?

1011


How do I round numbers?

969


What is difference between %d and %i in c?

1186