Link to home
Create AccountLog in
Avatar of rmrivera67
rmrivera67Flag for United States of America

asked on

multiplication table in miracle c

I have to  Write the pseudo code and the C source code for the following:

Write a multiplication table of users choice in descending order.

1. Prompt the user to enter number

2. Display the multiplication table using for loop

Example:  If user enters number 5

Your display should like this:

User requested to show the 5 times multiplication table:

5 times multiplication table is:

5  x   20  =  100

5   x  19  =   95

      &..

5  x  1   =     5

How would I do this in miracle c
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of n_i_c_o
n_i_c_o

Hi,
here is what you need:

pseudo code:

- save user input into variable num
- for i from 20 to 0 in -1 increment do



miracle C code:

#include <stdio.h>

int main(int, char**)
{
      int num,i;
      printf("Enter number:");
      fscanf(stdin, "%d", &num);

      for (i = 20; i > 0; i--)
            printf("%d x %d = %d\n", i, num, i*num);
      
      getchar();
      return 0;
}
Hi,
here is what you need:

pseudo code:

- save user input into variable num
- for i from 20 to 0 in -1 increment do
  - print i, num, i*num
- end for




miracle C code:

#include <stdio.h>

int main(int, char**)
{
      int num,i;
      printf("Enter number:");
      fscanf(stdin, "%d", &num);

      for (i = 20; i > 0; i--)
            printf("%d x %d = %d\n", i, num, i*num);
     
      getchar();
      return 0;
}
n_i_c_o, you shouldn't post complete source code for an assignment. Instead you should help the asker solve the problem himself. Not only is that in the rules of this site, it's also the best way to teach something like this.
Sorry about this.
I am new to the site. Will read the rules more carefully.
Regards,
N.
That's ok, n_i_c_o. I was merely pointing it out ;)
rmrivera67, did you get the help you wanted ? You don't have to accept an answer if you didn't.
Avatar of rmrivera67

ASKER

no didn't receive the response i needed, but the response was sufficient.
>> no didn't receive the response i needed, but the response was sufficient.

???? I don't get that ... Did you want help or not ? The answer you accepted was just asking for clarification which you never gave ...

Anyway ...
What I meant was that it was not necessary to proceed further with this. Thanks.