0% found this document useful (0 votes)
4 views1 page

practical3

The document outlines a practical exercise in programming using C, specifically focusing on finding the largest number among three numbers using if-else statements. It provides an example program that compares three integers and outputs the largest one. The conclusion emphasizes the learning of conditional statements in C.

Uploaded by

jadhaoshiv3012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

practical3

The document outlines a practical exercise in programming using C, specifically focusing on finding the largest number among three numbers using if-else statements. It provides an example program that compares three integers and outputs the largest one. The conclusion emphasizes the learning of conditional statements in C.

Uploaded by

jadhaoshiv3012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Practical no.

Title:- Programming in c.
Aim: Write a program using c find the largest number among three
number using if-else statement.

Objective: Learning conditional statement in c.

if-else Statement:
An if statement can be followed by an optional else statement.
The general form of if…else statement is –
if(condition)
{
Statement block
}
else
{
Statement block
}
Here, if block is called true block and the else block is called false block.

/* Program for find the largest number among thre number using if-else statement */
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int main()
{
int a = 10, b = 22, c = 9;

// Finding largest by comparing using relational operators


if (a > b)
{
if (a > c)
printf("%d is the largest number.", a);
else
printf("%d is the largest number.", c);
}
else {
if (b > c)
printf("%d is the largest number.", b);
else
printf("%d is the largest number.", c);
}

O/P: 22

Conclusion : Thus we studied conditional operator using if-else statement in C.

You might also like