Conditional Expression

Write and run a program that reads two integers and then uses the conditional expression operator to print either "Multiple" or "Not" according to whether one of the integers is a multiple of the other.

<< Go to Index Page >>

21 comments:

  1. #include

    main()
    {
    int a, b;
    while(scanf("%d %d", &a, &b)==2)
    {
    if(a%b==0||b%a==0)
    {
    printf("Multiple\n");
    }
    else
    {
    printf("Not\n");
    }
    }
    return 0;
    }

    ReplyDelete
  2. Replies
    1. while(scanf("%d %d", &a, &b)==2)
      Can you reply me: how does while returns 2; I don't understand

      Delete
  3. #include"stdio.h"
    void main()
    {
    int a,b;
    printf("Enter your first value:\t");
    scanf("%d",&a);
    printf("\nEnter your 2nd value:\t");
    scanf("%d",&b);
    printf("\nResult is:");
    if(a>b)
    {
    if(a%b==0)
    printf("\nMultiple");
    else
    printf("\nNot Multiple");
    }
    else if(a<b)
    {
    if(b%a==0)
    printf("\nMultiple");
    else
    printf("\nNot Multiple");
    }
    else
    printf("\nMultiple");

    getch();
    }

    ReplyDelete

  4. #include

    int main()
    {
    int a, n;
    printf("Enter a number: ");
    scanf("%d", &n);
    for(a = 0; a <= n; a++)
    {
    if (n == a * a)
    {
    printf("YES");
    return 0;
    }
    }
    printf("NO");
    return 0;
    }

    ReplyDelete
  5. Summer 2017
    ID#201610042

    Answer to the Question No 6:

    https://drive.google.com/file/d/0B99eePh0LV8gNXJtRldtTzdud0E/view?usp=drivesdk

    ReplyDelete
  6. https://www.dropbox.com/s/a3hcy9jcu5oycay/check06.cpp?dl=0

    ReplyDelete
  7. ID : 201620195
    https://drive.google.com/open?id=0B9K31ospCyFjb1E5STNXNjNQb0k

    ReplyDelete
  8. https://drive.google.com/open?id=0BzTqZMBWR6eOQW5SSk00di1VUGc

    ReplyDelete
  9. https://drive.google.com/open?id=0B8369pAqjVVpMklYVF9VYkdlOUU

    ReplyDelete
  10. wp. https://drive.google.com/open?id=0B8369pAqjVVpMklYVF9VYkdlOUU

    ReplyDelete
  11. ID:201520552
    https://drive.google.com/open?id=0B5pG0kIjzgEKRG9vd0kxeHU1N0k

    ReplyDelete
  12. ID 201610456
    MD USUF MIA
    https://drive.google.com/open?id=0B_PIGnOMR0K2Nk5wVUQ4UVF2cHc

    ReplyDelete
  13. 1.https://drive.google.com/open?id=0B7UQyRdu6h2wSXJxUG5VTkkwSU0

    ReplyDelete
  14. Id= 201710494
    https://www.dropbox.com/s/o55m0k7gpvbjrmm/prob%206.cpp?dl=0

    ReplyDelete
  15. https://drive.google.com/open?id=0B3bVD5Ppt_STc3htTmFvUTI0cUU

    ReplyDelete
  16. https://drive.google.com/open?id=0Byxq3aat_mNSZ1h1NWpWZF9LX3M

    ReplyDelete
  17. ID: 201620318
    https://drive.google.com/open?id=0B2gcteJZycWoa0NsSlNTZ3FCa2M

    ReplyDelete
  18. https://drive.google.com/open?id=0BzKpnVbF4fc3RGJEdGJhb0ttZjg

    ReplyDelete
  19. https://drive.google.com/open?id=0BzKpnVbF4fc3RGJEdGJhb0ttZjg

    ReplyDelete
  20. ID:-201610058

    1.https://drive.google.com/open?id=0B7UQyRdu6h2wSXJxUG5VTkkwSU0

    ReplyDelete