Results 1 to 2 of 2

Thread: Question!!!

  1. #1
    Junior Member
    Join Date
    Oct 2008
    Answers
    3

    Post Question!!!

    I hav another question wanna ask..... The question is as below:
    Write a program that contains 2 arrays which contained name and age
    Name Age
    Rose 8
    Jack 13
    Jin 20
    Katty 34
    1st array stored the names and 2nd array stored the age.
    classify them into children, teenagers and adult according 2 age. The output(name,age,classification)are to be saved in an output file.

    thanks a lot....


  2. #2
    Junior Member
    Join Date
    Oct 2008
    Answers
    12

    Re: Question!!!

    #include<stdio.h>
    main()
    {
    int num[10],i,n,child,teenager,adult,name;
    clrscr();
    printf("How many elements?");
    scanf("%d",&n);
    printf("\nEnter %s and %d=",name,n);
    for(i=0;i<n;i++)
    scanf("%d",&num[i]);
    adult=num[0];
    for(i=0;i<n;i++)
    {
    if(num[i]>adult)
    adult=num[i];
    }
    second=-999
    for(i=0;i<n;i++)
    {
    if(num[i]!=adult)
    if(num[i]>teenager)
    teenager=num[i]
    else
    child=num[i];
    }
    printf("\nAdult=%d",adult);
    printf("\nTeenage=%d",teenager);
    printf("\nchild=%d",child);
    getch():
    }


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
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact