What's new

Closed Guys pa help freshmen bsit about sa algorithms

Status
Not open for further replies.

A k o s i A j i n

Honorary Poster
Joined
Nov 15, 2016
Posts
306
Solutions
1
Reaction
66
Points
153
Age
24
Guys pagawa namn ako ng problem na to nahihirapan po talaga ako gagawin ko lang syang basis sa mga next problem..

Eto po yung problem
Write a algorithm that asks the user to enter two integers, obtains the numbers from the user, then prints the larger number followed by the words "is larger." If the numbers are equal, print the message "Theae numbers are equal."
Pa help po kung papano yung magiging process neto huhu
 
Step by step lang yan ah. Mas magandang aralin mo yan para pag nag com lab kayo isang tingin mo palang kaya mo na gumawa ng program na pinapagawa ng prof nyo.
 
Eto yung process. Di ko ilalagay yung code kasi spoonfeeding na yun.
Gawa ka dalawang variables.
Declare mo both as integers.
Ask ka ng input for variable 1 then 2
Gawa ka ng conditions
Condition 1: if var1>var2 ; print ("var1 is larger") else if
Condition 2: var1<var2 ; print "var2 is larger"
Else print "equal"
 
Try mo ito,

#include <iostream>
using namespace std;
int main()
{
int num1, num2; // declaration

cout << "Enter two integers: "; // prompt
cin >> num1 >> num2; // input to numbers

if ( num1 == num2 )
cout << "These numbers are equal." << endl;

if ( num1 > num2 )
cout << num1 << " is larger." << endl;

if ( num2 > num1 )
cout << num2 << " is larger." << endl;

return 0;
}
 
Try mo ito,

#include <iostream>
using namespace std;
int main()
{
int num1, num2; // declaration

cout << "Enter two integers: "; // prompt
cin >> num1 >> num2; // input to numbers

if ( num1 == num2 )
cout << "These numbers are equal." << endl;

if ( num1 > num2 )
cout << num1 << " is larger." << endl;

if ( num2 > num1 )
cout << num2 << " is larger." << endl;

return 0;
}
need ko lang po dito is yung step by step paps ako na po bahal sa code
 
Eto yung process. Di ko ilalagay yung code kasi spoonfeeding na yun.
Gawa ka dalawang variables.
Declare mo both as integers.
Ask ka ng input for variable 1 then 2
Gawa ka ng conditions
Condition 1: if var1>var2 ; print ("var1 is larger") else if
Condition 2: var1<var2 ; print "var2 is larger"
Else print "equal"

kuya thank you po nakuha ko na

last po na tanong pano namn po ito? kahit yung process lang po pag dating sa condition naguguluhan po kasi ako


Write a program that inputs three integers from the keyboard and prints the sum, average, product, smallest and largest of these numbers.
 
last po na tanong pano namn po ito? kahit yung process lang po pag dating sa condition naguguluhan po kasi ako


Write a program that inputs three integers from the keyboard and prints the sum, average, product, smallest and largest of these numbers.
 
Same as before pero
sum = num1 + num2 + num3
average = sum / 3
condition for min: if num1<num2 AND num1 <num3 THEN num1 is smallest
Do this hanggang num3 then para sa largest just change the operator to greater than
 
TS.. here's my tip:

don't ask questions here directly, if you want to learn programming..
Gawin mo muna bago ka magtanong.. kawawa ka talaga sa susunod..
 
when I was in grade 11 this is the most simplest program we do.
conditionals at arithmetic operators lang to.
declare a var : num1 and num2 as integer or any datatype except string.
and ask for an input from the user.


if num1 is greather than num2 then print
else if num1 is less than num2 then print
else num1 and num2 are equal then print

Code:
Dim num1 As Integer
Dim num2 As Integer

Console.Write("Enter 1st#: ")
num1 = Console.ReadLine

Console.Write("Enter 2nd#: ")
num2 = Console.ReadLine

If (num1 > num2) Then
Console.Write("num1 is Larger")
ElseIf (num1 < num2) Then
Console.Write("num2 is Larger")
Else
Console.Write("num1 and num2 are equal")
End If
 
Status
Not open for further replies.
Back
Top