Comparison Operator

Write and run a program that reads the users age and then prints "You are a Child" if the age < 18, " You are an adult." if 18<=age<65, and "You are a senior citizen." if age >=65.

<< Go to Index Page >>

38 comments:

  1. #include
    #include
    main()
    {
    int age;
    printf("enter your age: ");
    scanf("%d",&age);
    if(age<18)
    printf("you are child");
    else if(18<=age<=65)
    printf("you are adult");
    else if(age>65)
    printf("you are senior citizen");
    getch();
    return 0;
    }

    ReplyDelete
    Replies
    1. good job but its execution one time .it would be better if we would print all answer.carry on.....

      Delete
  2. #include

    main()
    {
    int age;
    while(scanf("%d", &age)==1)
    {
    if(age<18)
    printf("You are a Child.\n");
    else if(age>=18&&age<65)
    printf("You are an adult.\n");
    else if(age>=65)
    printf("You are a senior citizen.\n");
    }

    return 0;
    }

    ReplyDelete
  3. carry on.......and will be continued......

    ReplyDelete
  4. #include
    main(){
    int a;
    printf("Enter your age : ");
    scanf("%d",&a);
    if(a<18)
    printf("your are child!");
    else if(a>=18 && a<=65) printf("you are matured!");
    else printf("you are senior citizen");
    }

    ReplyDelete
  5. Summer 2017
    ID#201610042

    Answer to the Question No. 5:

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

    ReplyDelete
  6. https://www.dropbox.com/s/36plauesvs5xinr/age5.cpp?dl=0

    ReplyDelete
  7. https://www.dropbox.com/s/kswhmxj1qgy66s7/AGE.cpp?dl=0

    ReplyDelete
  8. https://www.dropbox.com/s/ep22h2f26bre576/agewithparamiter.cpp?dl=0

    ReplyDelete
  9. https://www.dropbox.com/s/h9uykmc7i537sv7/agewithparamiterwithreturn.cpp?dl=0

    ReplyDelete
  10. https://www.dropbox.com/s/39de6fy4lmxuapv/cal.cpp?dl=0

    ReplyDelete
  11. https://drive.google.com/file/d/0B0Llv4Ca9Ln6SXdSZFZkUUxvM1k/view?usp=sharing

    ReplyDelete
  12. corrected one;

    https://drive.google.com/file/d/0B0Llv4Ca9Ln6a3ZqWF9zS0lIOEE/view?usp=sharing

    ReplyDelete
  13. ID : 201620195
    https://drive.google.com/open?id=0B9K31ospCyFjUkNSd2FCMEtvNHc

    ReplyDelete
  14. https://drive.google.com/open?id=0BzTqZMBWR6eOYzlhUDdQV2UySm8

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

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

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

    ReplyDelete
  18. ID:201520552
    https://drive.google.com/open?id=0B5pG0kIjzgEKbXM1Y09rWjJOT3M

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

    ReplyDelete
  20. https://drive.google.com/open?id=0B7UQyRdu6h2wZmRjMXR0d0l2Nnc

    ReplyDelete
  21. https://drive.google.com/open?id=0Byxq3aat_mNSTzdOcHdyNzl1RkU

    ReplyDelete
  22. https://www.dropbox.com/s/a9xi1enq5nvh7cc/HW5%20witn%20constructor.cpp?dl=0

    ReplyDelete
  23. Md Nadim Khandaker
    ID: 201630510

    #include
    using namespace std;
    class people
    {
    public:
    int sum;
    void calculateage(int age)
    {
    if(age<18)
    cout<<"You are a child"<=18 && age<65)
    cout<<"you are an adult"<=65)
    cout<<"You are a senior citizen"<>age;

    people man;
    man.calculateage(age);
    }

    ReplyDelete
  24. https://drive.google.com/open?id=0BzKpnVbF4fc3NG1ValNVb3FMUFU

    ReplyDelete
  25. Name:Abdullah Papon
    ID:201710933
    https://drive.google.com/open?id=0B0bbxKUPFizZcmhScGFGcFdOQk0

    ReplyDelete
  26. https://drive.google.com/open?id=0B3bVD5Ppt_STOFQ5dFE1UVJwbEE

    ReplyDelete
  27. Id= 201710494
    https://www.dropbox.com/s/z5f6ag4f7gi09mv/prob%205.cpp?dl=0

    ReplyDelete
  28. https://drive.google.com/open?id=0BxajN_bZJJw0Tl9FMGdNTEN1X0E

    ReplyDelete
  29. https://www.dropbox.com/s/bctvl89kdmgv1fk/AGE.cpp?dl=0

    ReplyDelete
  30. https://drive.google.com/open?id=0B97tDB8iESNCdElmSXBQM3hqMnM

    ReplyDelete
  31. https://drive.google.com/open?id=0B8uArqPAKtGrM1phdE1jcGU1NWc

    ReplyDelete
  32. https://drive.google.com/open?id=0B8uArqPAKtGrM1phdE1jcGU1NWc

    ReplyDelete
  33. https://drive.google.com/open?id=0B8uArqPAKtGrX3FqcUFhMHJ6clU

    ReplyDelete
  34. ID: 201620318
    https://drive.google.com/open?id=0B2gcteJZycWoN2NOMHgwVGdGM0U

    ReplyDelete
  35. https://drive.google.com/open?id=0B5eevQy6QwSOS0dIYk1QNTZEX1k

    Name: Bithi Paul, ID:201631161

    ReplyDelete
  36. https://drive.google.com/open?id=0Bw0-FMVCC94QWnRMVEJBVnJqZW8

    ReplyDelete
  37. ID:-201610058

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

    ReplyDelete