My Computer Forum Computer Science Forum

Go Back   My Computer Forum > Computer Science Forum > Programming

Programming Programming Languages, Interpreters, and Compilers - Assembly, Declarative, Machine, Object Oriented, Iterative


Reply
 
LinkBack Thread Tools Display Modes
November 1st, 2009, 08:27 AM   #1
 
Joined: Nov 2009
Posts: 1
Program to find sum of 3 integers...

Could someone help me with this please.

Write a program that will prompt the user for three integers. The program should then find the difference between the largest and smallest integers. The program should also calculate the sum of the three inegers and also their product and average. Display to the user difference, sum, product and average.
N.B The user should not be able to enter the same number more than once. Your program should be user friendly.

Print "Greetings"
Process_three_integers_of_different_values
INPUT "Please enter an integer."
N1
INPUT "Please enter another different integer."
N2
INPUT "Please enter another different integer."
N3

set sum to zero

IF (N1>N2 & N1>N3)

largest=N1;

ELSE IF(N2>N3 & N2>N1)

largest=N2;

ELSE
largest=N3;

IF(N1<N2 & N1<N3)

smallest=N1;

ELSE IF(N2<N3 & N2<N1)

smallest=N2;

ELSE
smallest=N3;

difference = largest - smallest
sum = N1 + N2 + N3
product = N1*N2*N3
average = sum/3
BrainByMattel is offline  
 

My Computer Forum is free to register and we welcome everyone!

Reply

  My Computer Forum > Computer Science Forum > Programming

Tags
find, integers, program, sum



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find interval with the smallest variance in sequence keram Algorithms 0 March 10th, 2014 01:15 PM
Reinstalling an expired program Mathmonster Computer Science 0 July 20th, 2013 12:00 PM
What language(s) do you prefer to program in? Infinity Computer Science 36 March 16th, 2013 03:44 AM
Best Screencasting Program Nerazzurri_KZ Computer Science 3 July 11th, 2012 02:55 AM
C++ program code, need help with this C++ application. chetanbhasin Programming 0 June 17th, 2010 06:57 PM





Copyright © 2018 My Computer Forum Forum. All rights reserved.