473,386 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Help me in completing a program

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 1651
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
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
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
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? ...
16
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...
3
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 =...
2
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...
2
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...
2
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...
11
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...
0
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...
4
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...

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.