Thursday, February 24, 2011

0

C Language: Basic Operation (addition,subtraction,multiplication,division)

  • Thursday, February 24, 2011
  • RJ
  • Share
  • This program is about the basic operation of C language such as addition,subtraction,multiplication and division. Observe the codes and on how i used the + for addition, - for subtraction, * for multiplication and / for division. Just like common mathematics solution c language is also convenient to use and have a lot of usage. Without further much check the output of my program.



    It's so funny because my program is so basic and simple. Well, maybe I will also how to use the other operations of mathematics that the C language can be used. Now try to check the codes that i have used. For me it's a good start and somehow I can do better than these.



    #include<stdio.h>
    #include<conio.h>
    
    main()
    {     printf("C program by RJ!");
    int num1,num2;
    int sum,dif,pro,quo;
    printf("\n\nEnter First Numbers: ");
    scanf("%d",&num1);
    printf("Enter First Numbers: ");
    scanf("%d",&num2);
    
    sum=num1+num2;
    dif=num1-num2;
    pro=num1*num2;
    quo=num1/num2;
    
    printf("\nThe SUM of two numbers is %d",sum);
    printf("\nThe DIFFERENCE of two numbers is %d",dif);
    printf("\nThe PRODUCT of two numbers is %d",pro);
    printf("\nThe QUOTIENT of two numbers is %d",quo);
    
    getch();
    }

    0 Responses to “C Language: Basic Operation (addition,subtraction,multiplication,division)”

    Post a Comment

    Subscribe