Page 2 of 9 FirstFirst 12345 ... LastLast
Results 11 to 20 of 82
  1. #11

    @smarkies: if control statement pa mn gitudlo sa ila... so murag dili pa na pwede sa ila na imong code. I think kanang input jud nimo dapat walay comma.

  2. #12
    Enter two integers separated by a space: 15 77
    15, 77
    Press any key to continue...
    murag sakto ko... tungod sa getch... sa last part ra na ibutang imong getch();

  3. #13
    pwede rmn butang comma nia sa printf
    C rmn xad ni. ang ako ani sauna kai gamay rjd ang code
    isud nlng ang opertaion sa imung statement sa if
    mfunction rmn jpon na. gamai pa imung codes
    dli pd complicated tanawon

  4. #14
    wala koy compiler diri...
    peru murag mao na ni ang solution
    Code:
    #include<stdio.h>
    #include<conio.h>
    int add(int, int);
    int subtract(int, int);
    float divide(int, int);
    int multiply(int, int);
    void main(void)
    {
     int a, b, d, e, f;
     float g;
     char c;
     clrscr();
     printf("Enter two integers separated by a space:\n");
     scanf("%d %d", &a, &b);
     printf("Actions:\n(A) Add\n(S) Subtract\n(D) Divide\n(M) Multiply\n");
     printf("Choice:\n");
     scanf("%c", &c);
     if (c=='A')
     {
      d=add(a, b);
      printf("The sum of %d and %d is %d", a, b, d);  
     }
     if (c=='S')
     {
      e=subtract(a, b);
      printf("The difference of %d and %d is %d", a, b, e);  
     }
     if (c=='D')
     {
      float e;
      g=divide(a, b);
      printf("The quotient of %d and %d is %d", a, b, g);  
     }
     if (c=='M')
     {
      f=multiply(a, b);
      printf("The product of %d and %d is %d", a, b, f);  
     }
     getch();
    }
    int add(int a, int b)
    {
     return (a+b);
    }
    int subtract(int a, int b)
    {
     return (a-b);
    }
    int multiply(int a, int b)
    {
     return (a*b);
    }
    float divide(int a, int b)
    {
     return ((float)a/b);
    }
    gipang-remove ra nako ang mga getch() except the last one...
    and sa input... dili ko sure kung pwede ba comma kay wla ko compiler diri... to be sure...seperate it by space na lng jud.

  5. #15
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    Quote Originally Posted by xiao_xiao View Post
    murag sakto ko... tungod sa getch... sa last part ra na ibutang imong getch();
    I'm afraid not...

  6. #16
    Quote Originally Posted by xiao_xiao View Post
    wala koy compiler diri...
    peru murag mao na ni ang solution
    gipang-remove ra nako ang mga getch() except the last one...
    and sa input... dili ko sure kung pwede ba comma kay wla ko compiler diri... to be sure...seperate it by space na lng jud.
    Compiled..

    Ddi gihapon na pwedi same ra gihapon sa iyang first post mo exit ang program.

    Ari man na sangit pag store sa a and b, then mag store napud sa c.

    sige try nako ron dili mag gamit ug do while statement.

    Mao man gud ni sabot nako.

    The great thing about pseudo-code is that it doesn't have to be correct syntax, it just has to demonstrate the logic of your program. I would often throw together a combination of diagrams/pseudocode before beginning a project.

    The program will run inside a do-while loop (it executes the code inside it at least once, since the condition is checked at the end instead of the beginning)

  7. #17
    aw u.. sakto.. murag dili diay sa getch()... wla mn diay xa ga getch before gi print niya ang choices.

  8. #18
    dara final na dyud ni.

    PHP Code:
    #include<stdio.h>
    #include<conio.h>
    int add(intint);
    int subtract(intint);
    float divide(intint);
    int multiply(intint);

    main(void)
    {
     
    int abdef;
     
    float g;
     
    char c;
     
    clrscr();

     
    printf("Select an operation:\n(A) Add\n(S) Subtract\n(D) Divide\n(M) Multiply\n");
     
    printf("Choice: ");
     
    scanf("%c",&c);

     
    printf("\nEnter two integers separated by a space: ");
     
    scanf("%d %d", &a, &b);

     if (
    c=='A')
     {
      
    d=add(ab);
      
    printf("The sum of %d and %d is %d"abd);
      
    getch();
     }

     if (
    c=='S')
     {
      
    e=subtract(ab);
      
    printf("The difference of %d and %d is %d"abe);
      
    getch();
     }

     if (
    c=='D')
     {
      
    g=divide(ab);
      
    printf("The quotient of %d and %d is %.2f"abg);
      
    getch();
     }

     if (
    c=='M')
     {
      
    f=multiply(ab);
      
    printf("The product of %d and %d is %d"abf);
      
    getch();
     }
     
    getch();

    }


    int add(int aint b)
    {
     return (
    a+b);
    }
    int subtract(int aint b)
    {
     return (
    a-b);
    }
    int multiply(int aint b)
    {
     return (
    a*b);
    }
    float divide(int aint b)
    {
     return ((float)
    a/b);

    Another code kung for the case. else if

    PHP Code:
    #include<stdio.h>
    #include<conio.h>
    int add(intint);
    int subtract(intint);
    float divide(intint);
    int multiply(intint);

    main(void)
    {
     
    int abdef;
     
    float g;
     
    char c;
     
    clrscr();

     
    printf("Select an operation:\n(A) Add\n(S) Subtract\n(D) Divide\n(M) Multiply\n");
     
    printf("Choice: ");
     
    scanf("%c",&c);

     
    printf("\nEnter two integers separated by a space: ");
     
    scanf("%d %d", &a, &b);

     if (
    c=='A')
     {
      
    d=add(ab);
      
    printf("The sum of %d and %d is %d"abd);
      
    getch();
     }
     else  if (
    c=='a'){
      
    d=add(ab);
      
    printf("The sum of %d and %d is %d"abd);
      
    getch();
     }

     if (
    c=='S')
     {
      
    e=subtract(ab);
      
    printf("The difference of %d and %d is %d"abe);
      
    getch();
     }
     else if (
    c=='s'){
      
    e=subtract(ab);
      
    printf("The difference of %d and %d is %d"abe);
      
    getch();
     }

     if (
    c=='D')
     {
      
    g=divide(ab);
      
    printf("The quotient of %d and %d is %.2f"abg);
      
    getch();
     }
     else if (
    c=='d'){
      
    g=divide(ab);
      
    printf("The quotient of %d and %d is %.2f"abg);
      
    getch();
     }

     if (
    c=='M')
     {
      
    f=multiply(ab);
      
    printf("The product of %d and %d is %d"abf);
      
    getch();
     }
     else if (
    c=='m'){
      
    f=multiply(ab);
      
    printf("The product of %d and %d is %d"abf);
      
    getch();
     }
     
    getch();

    }


    int add(int aint b)
    {
     return (
    a+b);
    }
    int subtract(int aint b)
    {
     return (
    a-b);
    }
    int multiply(int aint b)
    {
     return (
    a*b);
    }
    float divide(int aint b)
    {
     return ((float)
    a/b);

    Ouput:

    Addition



    Division



    Last edited by SmaRkieS; 02-11-2010 at 03:21 PM. Reason: output picture

  9. #19
    nag post gud si markcuering ani
    ]
    Enter two integers separated by a space: 15 77
    15, 77
    Press any key to continue...
    i thought gikan ni sa code sa TS... nag conclude dayon ko nga bacn getch...
    dili mn diay ni code sa TS...

  10. #20
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    float e; <-- use for what?
    printf("The quotient of %d and %d is %d", a, b, g); <-- how you output floating point numbers?

  11.    Advertisement

Page 2 of 9 FirstFirst 12345 ... LastLast

Similar Threads

 
  1. Help me in my laptop problem
    By Wenxp7 in forum Computer Hardware
    Replies: 16
    Last Post: 10-08-2010, 07:48 PM
  2. pls help me in my pldt dsl connection...
    By glenntacan in forum Networking & Internet
    Replies: 5
    Last Post: 01-23-2009, 05:15 PM
  3. help me in my front panel config
    By absimon in forum Computer Hardware
    Replies: 5
    Last Post: 12-05-2008, 07:18 PM
  4. Please help me in martial arts.
    By Chalil in forum Sports & Recreation
    Replies: 11
    Last Post: 09-20-2006, 10:52 PM
  5. Where can I repair my flash drive?!!! Help me!!!
    By jonmlas in forum Gizmos & Gadgets (Old)
    Replies: 13
    Last Post: 11-30-2005, 12:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top