Monday, July 27, 2009

Write a program to do the following...C PROGRAMMERS PLEASE!!....?

Write a program to do the following:


(a) create a loop that generates the integers from 1 to 50


(b) for each, print out the divisors on a single line. The first few lines will look like this:


1 is evenly divisible by 1


2 is evenly divisible by 1, 2


3 is evenly divisible by 1, 3


4 is evenly divisible by 1, 2, 4


5 is evenly divisible by 1, 5


6 is evenly divisible by 1, 2, 3, 6

Write a program to do the following...C PROGRAMMERS PLEASE!!....?
#include%26lt;stdio.h%26gt;


#include%26lt;conio.h%26gt;


void main()


{


int n,i,r;


for(n=1;n%26lt;=50;n++)


{


printf("%d is evenly divisible by ",n);


for(i=1;i%26lt;=n;i++)


{


if(n%i==0)


{


printf("%d ",i);


}


}


printf("\n");


}


getch();


}


No comments:

Post a Comment