Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Finding the Smallest and Largest Numbers using C Programming, Exercises of Computer Fundamentals

This c program includes necessary libraries and declares the main function to find and display the smallest and largest numbers among three user inputs. Users are prompted to enter values for variables a, b, and c using scanf function. The program uses if-else statements to determine and print the smallest and largest numbers.

Typology: Exercises

2011/2012

Uploaded on 07/31/2012

karthik
karthik 🇮🇳

4.6

(17)

100 documents

1 / 2

Toggle sidebar

Related documents


Partial preview of the text

Download Finding the Smallest and Largest Numbers using C Programming and more Exercises Computer Fundamentals in PDF only on Docsity! /*In the very first step of program,the library will be included which will contain necessary information of commands i used in the program.*/ #include<stdio.h> /*second step is the declaration ,that main function of the program is integer type function*/ int main() /*the program is written in the middle brackets{}*/ { /*it is the declaration that variables are of which type*/ float a,b,c; /*topic of program*/ printf("TO FIND SMALLEST AND LARGEST INPUT\n\n\n"); /*by this printf command user will be able to know that he has to enter input here*/ printf("Please give values of a,b,c\na="); scanf("%f",&a); printf("b="); scanf("%f",&b); printf("c="); scanf("%f",&c); /*the following if else command will find out the lowest number among all inputs*/ if (a<b) { if (a<c) { printf("a=%.3f is smallest\n",a); } else { printf("c=%.3f is smallest\n",c); } } else { if (b<c) { printf("b=%.3f is smallest\n",b); docsity.com
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved