Geeks Talk

Prepare for your Next Interview




Question!!!

This is a discussion on Question!!! within the C and C++ forums, part of the Software Development category; 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 ...


Go Back   Geeks Talk > Software Development > C and C++

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 10-02-2008
Junior Member
 
Join Date: Oct 2008
Location: Malaysia
Posts: 3
Thanks: 1
Thanked 2 Times in 1 Post
bee896 is on a distinguished road
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....
Reply With Quote
The Following 2 Users Say Thank You to bee896 For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 10-25-2008
Junior Member
 
Join Date: Oct 2008
Location: India
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Ayesha Siddiqua is on a distinguished road
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():
}
Reply With Quote
Reply

  Geeks Talk > Software Development > C and C++


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
asp question shimulpaul ASP.NET 8 1 Week Ago 11:54 PM
question sumerram Interviews 6 09-01-2008 11:01 PM
php question sunilkumar_godd PHP 1 08-21-2008 05:55 AM
EIM Question dravikumar23 Seibel 0 08-15-2008 08:35 AM
Question shitalpatil Brainteasers 3 03-08-2007 07:32 AM


All times are GMT -4. The time now is 02:00 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved