Program questions.. for ITERATIVE STATEMENTS

Jan 21, 2013 at 1:21pm
Using while loop
1. Make and run a program that will output all the common factors of two numbers.
2. Make and run a program that will display all the consonants from ’A’ to ’Z’.
Using do-while loop
1. Make and run a program that will output all the prime numbers from 1-100.
2. Make and run a program that will allow the user to input ten numbers and display the total number of positive and negative numbers entered.
Using for loop
1. Make and run a program that will display the numbers 1, 2, 3, and so on depending on the number of lines the user will enter. For example, if input=3, first line of output should be 1, next line 2 3, and the last line 4 5 6.
2. Make and run a program that will be able to display the following output:
        *
      *    *
*   *   *    *   *
  *   *    *   *
*   *   *    *   *
      *    *
        *

Jan 21, 2013 at 1:40pm
Please, show what you have done at this point. We are willing to help you with problems you encountered, but we won't do your homework for you.
Jan 23, 2013 at 1:03pm
for number 1:::
#include<stdio.h>
#include<conio.h>
main()
{
int num1,num2,divisor;
printf("Enter a 2 integers: \n");
scanf("%d%d",&num1,&num2);
printf("The common factors of %d",num1);
printf(" and %d",num2);
printf(" is:\n");
(divisor=num1)&&(divisor=num2);
while(divisor>0)
{
if((num1%divisor==0)&&(num2%divisor==0))
printf("\n%d",divisor);
divisor--;
}
getch();
return0;
}
Jan 23, 2013 at 1:09pm
for number 2 (while loop & do-while loop) is hard for me the rest its okay ....
Topic archived. No new replies allowed.