473,795 Members | 3,100 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help me in completing a program

1 New Member
I have com across a program in which I should take 17 as a global constant.
I have to take 17 inputs.
for those inputs ..
I have to find
the number of even numbers entered
the number of odd numbers entered
the number of prime numbers entered
smallest number among those 17
largest number among those 17
factorial of the smallest number
the first number
the last number
power of the first number and the last number

These should come under a single main function.
I have done
number of even
number of odd
number of prime

I am finding some difficulties in finding
largest and smallest numbers
The main problem is I should not use arrays as well as any other functions for these..
So without using arrays
I have to find a solution..
Please can u help me in finding a solution using for loops,while loops
etc.
Dec 30 '06 #1
3 1673
vpawizard
66 New Member
For largest, take a variable x containing -inf (theorotically, practically lowest number data type supports). Compare each of 17 elements with x. If element is greater than x, store it in x and proceed.
Dec 30 '06 #2
nachu
15 New Member
Hope U Can Have A Variable (say Val).
1.store The First Number U Get As Input In It.
2.then After Getting The Next Number Check If It Is Greater Than Val, If It Is Exchange The Values.
3.repeat This For Every 17 Numbers Or So....
4.you Can Do The Vice-versa For The Lowest Number By Checking For <.

Try It..hope It Will Work..
Jan 2 '07 #3
thefarmer
55 New Member
I have com across a program in which I should take 17 as a global constant.
I have to take 17 inputs.
for those inputs ..
I have to find
the number of even numbers entered
the number of odd numbers entered
the number of prime numbers entered
smallest number among those 17
largest number among those 17
factorial of the smallest number
the first number
the last number
power of the first number and the last number

These should come under a single main function.
I have done
number of even
number of odd
number of prime

I am finding some difficulties in finding
largest and smallest numbers
The main problem is I should not use arrays as well as any other functions for these..
So without using arrays
I have to find a solution..
Please can u help me in finding a solution using for loops,while loops
etc.

hi there,

it seems that we are very willing to help you, but for now i strongly suggest that you post something, coz some people here are too busy to encode codes from the scratch, so post something and we'll see..
ok

regards,
Jan 3 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

31
14351
by: da Vinci | last post by:
OK, this has got to be a simple one and yet I cannot find the answer in my textbook. How can I get a simple pause after an output line, that simply waits for any key to be pressed to move on? Basically: "Press any key to continue..." I beleive that I am looking for is something along the lines of a....
16
2822
by: Simon | last post by:
I am a programming student and have recently missed two weeks of school due to a serious injury in a car accident. I am completing all of my assignments (via Labs) but have come across the following lab and can't seem to put it all together. The scenario: A small airline has just purchased a computer for its new automated reservations system. You have been asked to program the new system. You are to write a program to assign seats...
3
4047
by: Lobbo1 | last post by:
Hi, Im a computing student and need help with some pseudocode. The following is what I have got so far... SET point_value = 10 SET suit_value = Hearts SET point_valueA = suit_valueA = guess_count = game_count = = 0 REPEAT OUTPUT message to operator for suit_valueA GET suit_valueA
2
4458
by: RajS | last post by:
Hi All, I have created this UI program, i call couple of database procedures and update process steps to list box. Program runs fine, but I have problem. What happens is I dont see the update as it happens, I see all of them after completing all the procedure run. for example:
2
1582
by: Vinny | last post by:
I'm writing a small ASP program which prompts the user for data. I would like to interactively validate the data as they are entering it, rather than waiting until they submit the form. So, I am doing something like this (this is a very simple example): <head> <script language=javascript> function validatefield1()
2
1647
by: Vinny | last post by:
A customer wants me to convert a VB app I wrote for them into a web app for remote users to do data entry. So, I'm writing a small ASP program which prompts the user for data, much like a VB program. I would like to interactively validate the data as they are entering it, rather than waiting until they submit the form. So, I am doing something like this (this is a very simple example): <head>
11
2892
by: miss_Lolitta | last post by:
Hi all,, I am hoping that you will help me. I have trouble how I can complete the code of program that allows the user to input a number of integers such as N, and then stores them in an integer matrix where: 1- The dimension of matrix = NXN. 2-Entries of matrix can take any number from 0-2. 3- Arrangement of entries of first row is the same arrangement of entries of first column. 4-The diagonal of matrix =o. 5- Total of every row...
0
2023
by: redmondtab | last post by:
I have done this . Write a C program that will accept keyboard input and display a loan amortization schedule back on the screen. The program should ask for the Loan Amount (real number), Term of the Loan in months (integer), and the Interest Rate (real number); the input data should be validity checked. The output should list a heading showing the input values, then a separate line indicating Payment Number, Loan Balance, Payment...
4
2399
by: ShutterMan | last post by:
I have a JSON object as below (data is from SQL Server Northwind Database). But doing an eval on it returns an error "unterminated string constant" or such. Can someone help me pinpoint the element that is causing the grief? Sorry to post the entire object, but Im hoping someone has a parse utility that will help find whats wrong. { "TABLE":}, { "COL":"},{"DATA":"Education includes a BA in psychology from Colorado State University in...
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10163
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.