Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

closed If I send number 1 to 10 it need to multiply with 2, if I send number 11 to 20 it need to multiply with 36

+2 votes
asked Sep 19, 2021 by TN CODER (280 points)
closed Sep 22, 2021 by TN CODER

If I send a number it need to multiply.
Example: If I send number 1 to 10 it need to multiply with 2

                If I send number 11 to 20 it need to multiply with 36

How can I ? Please help me...

My code.  (The "amount" is the value enterring  and the enter number is the one is multiplying. 

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

main(){
    int a, b, c;
    printf("\tTITLE");
    printf("\nEnter amount: ");
    scanf("%d", &a);
    printf("Enter Number: ");
    scanf("%d", &b);
    c = a*b;
    printf("Ans: %d", c);
    printf("\nThank you for using!!!");
}

Help me please...........

closed with the note: I got answer for this question by helping hearts..

2 Answers

+1 vote
answered Sep 22, 2021 by sireesha B (540 points)
selected Sep 22, 2021 by TN CODER
 
Best answer
#include<stdio.h>
#include<stdio.h>
void main()
{
    int a,mul;
    printf("Enter the numbers");
    scanf("%d",&a);
    if( (a>=1)&&(a<=10))
{
      mul=a*2;
      printf("a is multiplied by 2=%d",mul);
}
else if((a>=11)&&(a<=20))
  {
   mul=a*36;
   printf("a is multiplied by 36=%d",mul);
  }
else
   printf("the entered number is not valid");
}
commented Sep 22, 2021 by TN CODER (280 points)
Thank you bro foe helping me by giving code's. :)
+1 vote
answered Sep 20, 2021 by Peter Minarik (84,720 points)

You need to use the if statement.

Please, check out online how to use it. You can fine one of the many tutorials here.

If you have still problems, please share your attempt with if and I'll be happy to help you from there.

commented Sep 22, 2021 by TN CODER (280 points)
Thank you, for helping me :)
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...