Accept any number from the user. Display its multiple

Accept any number from the user. Display its multiple

Page 1 of 1

3 Replies - 1304 Views - Last Post: 23 September 2008 - 11:37 PM Rate Topic: -----

#1 shiriru_613  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 19-September 08

Accept any number from the user. Display its multiple

Posted 19 September 2008 - 07:43 AM

Accept any number from the user. Display its multiple. The range of the inputed numbers are from 1 to 10. and the range of its divisibility is up to 100 ONLY.

thanks.,

#include<stdio.h>
#include<conio.h>

main()
{ int x,y,input;
  clrscr();
  printf("MULTIPLES\n");
  printf("Enter Number(1-10)==>\n");
  scanf("%d",&input);
  for(x=input;x<=100;x++)
{
     printf("%d\t",x);
}
  getch();
}



this is what i did but its wrong don;t know what to do with this..,

HELP!

example of output:
2
4
6
8
10
12
.
.
..
100



I'M USING TURBOC!!


MOD EDIT: Please :code:
thanks, gabehabe :)

This post has been edited by gabehabe: 19 September 2008 - 08:28 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Accept any number from the user. Display its multiple

#2 gabehabe  Icon User is offline

  • GabehabeSwamp
  • member icon




Reputation: 1382
  • View blog
  • Posts: 10,962
  • Joined: 06-February 08

Re: Accept any number from the user. Display its multiple

Posted 19 September 2008 - 08:30 AM

Try changing for(x=input;x<=100;x++) to for(x=input;x<=100;x+=input)

You want to add input to x on each iteration.

Hope this helps :)
Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6058
  • View blog
  • Posts: 23,496
  • Joined: 23-August 08

Re: Accept any number from the user. Display its multiple

Posted 19 September 2008 - 09:58 AM

Quote

I'M USING TURBOC!!


Please get your instructor into the 21st century and upgrade your compiler!!!
Was This Post Helpful? 0
  • +
  • -

#4 kokila.s  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 23-September 08

Re: Accept any number from the user. Display its multiple

Posted 23 September 2008 - 11:37 PM


#include<stdio.h>
void main()
{
  int choice;
 int i;
printf("\n enter the choice");
scanf("%d",&choice);

for(i=choice;i<100;i++)
{
   if(choice%i==0)
printf("%d \n ",i);

else
  continue;
}
}




#include<stdio.h>
void main()
{
  int choice;
 int i;
printf("\n enter the choice");
scanf("%d",&choice);

for(i=choice;i<100;i++)
{
   if(choice%i==0)
printf("%d \n ",i);

else
  continue;
}
}


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1