Pseudo code to find minimum among three numbers in python


Asked by admin @ in Computer Science viewed by 377 People


Pseudocode to find the minimum among three numbers

Answered by admin @



Example

Input: first = 15, second = 16, third = 10

Output: 10

Input: first = 5, second = 3, third = 6

Output: 3

Approach:

Check if the first element is smaller than second and third. If yes then print it.

Else if check if the second element is smaller than first and third. If yes then print it.

Else third is the smallest element and print it.

Below is the implementation of the above approach:

// C++ implementation to find

// the smallest of three elements

#include <bits/stdc++.h>

using namespace std;

int main()

{

int a = 5, b = 7, c = 10;

if (a <= b && a <= c)

cout << a << " is the smallest";

else if (b <= a && b <= c)

cout << b << " is the smallest";

else

cout << c << " is the smallest";

return 0;

}

Output:

5 is the smallest


Similar Questions

Program to find greatest of three numbers in python

Asked by admin @ in Computer Science viewed by 346 persons

Write a program in python to find the greatest number among three numbers​

Find numbers between 1 and 100 having exactly three factors

Asked by admin @ in Math viewed by 356 persons

Which are the numbers between 1 and 100 having exactly three factors

Find three rational numbers between 3 and 4

Asked by admin @ in Math viewed by 301 persons

Find three rational number between 3 and 4

Find three rational number between 3 and 4

Asked by admin @ in Math viewed by 331 persons

Find three rational number between 3 and 4

Find three consecutive even numbers whose sum is 96

Asked by admin @ in Math viewed by 390 persons

What is three consecutive even numbers whose sum is 96.

Write a program to find average of three numbers

Asked by admin @ in Computer Science viewed by 341 persons

Write a program to find average of three numbers.

Find three consecutive even numbers whose sum is 234

Asked by admin @ in Math viewed by 388 persons

Find three consecutive even numbers whose sum is 234

Find three rational number between 1 4 and 1 3

Asked by admin @ in Math viewed by 315 persons

Find three rational number between 1/4 and 1/3

Find three rational numbers between 1 3 and 1 5

Asked by admin @ in Math viewed by 346 persons

Give three rational numbers lying between 1/3 and 1/5

Find three rational numbers between 5 7 and 9 11

Asked by admin @ in Math viewed by 304 persons

Find three different irrational number between 5/7 and 9/11

Find three rational number between 2 3 and 5 6

Asked by admin @ in Math viewed by 304 persons

Find three rational number between 2/3 and 5/6

Find three rational numbers between 1 4 and 1 2

Asked by admin @ in Math viewed by 325 persons

Find three rational number between 1 by 4 and 1 by 2

Find three rational number between 3 5 and 4 5

Asked by admin @ in Math viewed by 307 persons

Find three rational numbers between 3/5 and 4/5​

Find three rational number between 5 7 and 9 11

Asked by admin @ in Math viewed by 332 persons

Find three different irrational number between 5/7 and 9/11

Find three irrational numbers between 3 and 4

Asked by maham237 @ in Mathematics viewed by 310 persons

Write three irrational numbers between 4 and 5.

Most viewed questions in Computer Science


A programmer mistakenly writes gor instead of for

Asked by admin @ in Computer Science viewed by 19030 persons


Domestic data entry operator ncert book class 9 solutions

Asked by admin @ in Computer Science viewed by 15816 persons


Information technology code 402 class 9 solutions chapter 1

Asked by admin @ in Computer Science viewed by 10977 persons



Ncert solutions for class 8 computer chapter 1 computer system

Asked by admin @ in Computer Science viewed by 10407 persons


A scrum team works on a 4 weeks sprint

Asked by admin @ in Computer Science viewed by 8723 persons


Which of the following occupies more memory in c

Asked by admin @ in Computer Science viewed by 8145 persons



A database of motor vehicles has the base entity

Asked by admin @ in Computer Science viewed by 7845 persons


The network architecture can be termed as a mcq

Asked by admin @ in Computer Science viewed by 6492 persons


Cat5 and cat6 cabling refer to which reference model layer

Asked by admin @ in Computer Science viewed by 5796 persons



Class 7 computer chapter 3 questions and answers

Asked by admin @ in Computer Science viewed by 5696 persons


Choose the correct options about usability and user experience

Asked by admin @ in Computer Science viewed by 5479 persons


Which advocates daily team meetings for coordination and integration

Asked by admin @ in Computer Science viewed by 4986 persons



Which three security features match the database security level

Asked by admin @ in Computer Science viewed by 4976 persons


Which of the dbms package is not available

Asked by admin @ in Computer Science viewed by 4690 persons


________ aid a business grow and attain its objectives

Asked by admin @ in Computer Science viewed by 4492 persons