Could we find the largest among three numbers using 'for' and if?
I have the following program, please check it
#include<stdio.h>
main()
{
int a,b,c,sum=o,i';
printf("enter the numbers");
scanf("%d%d%d",&a,&b,&c);
sum=a+b+c;
for(i=sum;i<=sum,i--)
{
if(i==a||i==b||i==c)
printf("%d the greatest");
exit();
}}........please clarify the logic if it is correct to the intention..
Daita 0 Newbie Poster
Shankye 36 Junior Poster
Daita 0 Newbie Poster
Shankye 36 Junior Poster
Daita 0 Newbie Poster
Daita 0 Newbie Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Daita 0 Newbie Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Daita 0 Newbie Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Shankye 36 Junior Poster
Trentacle 112 Junior Poster in Training
Shankye 36 Junior Poster
Daita 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.