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
Recommended Answers
Jump to Postenclose within CODE tag
Jump to PostSorry, I can't see your screen from here. It might be nice to let us know what errors -- or should we guess?
Jump to PostOK, now maybe you can tell us what lines the errors are on.
:icon_rolleyes:
Jump to PostSo the e in include is using i before definition and the d in stdio.h is a function call missing?
Sorry, but this is like pulling teeth. If you want help, you MUST give us all the information necessary to understand the problem. Not bits and pieces that are …
All 14 Replies
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.