🎓 Academic FREE Çℎḙḡḡ, SCRIBD, STUDOC, AND BARTLEBY THREAD UNLOCK (CLOSED)

Status
Not open for further replies.
sa second link mo po baka my classmate ka dito naka unlock kasi ako ng ganyan hehehe
 

Attachments

Pa unlock po lods salamat :))
https://www.Çℎḙḡḡ.com/homework-help...62?trackid=27a2e8e6413f&strackid=f5ddefc34545
 
https://www.Çℎḙḡḡ.com/homework-help...eginning-n-ending-m-n-m-inputted-us-q62955551

pa unlock po. Thank you :)
 
#include <stdio.h>

int main()
{
int n,m ,sm=0,w;
printf("Enter Beginning Number:");
scanf("%d",&n);
printf("Enter Ending Number:");
scanf("%d",&m);
w=n;
//checking weather the n is equal to m
if(n==m)
{
//printing required output
printf("Error in input.Beginning and Ending numbers are the same.");

}
//checking weather n is greater than m
else if (n>m)
{
//printing required output
printf("Error in input. Beginning number is larger than the Ending number");
}
//if none of condition is true
else
{
//looping through all element fromn to m
while(w<=m)
{
//checking weather the element is odd
if (w%2!=0)
{
//if odd then add it to sm
sm=sm+w;
}
//increment w by 1
w++;
}
//printing result
printf("The sum of all odd numbers from %d to %d is %d",n,m,sm);

}

return 0;
}
 
Thank you! Wala po kasing binigay na example si Mam. I have the same answer po but different lang po ang structure and statement kaya po nag-eerror ang program.
 
Status
Not open for further replies.

About this Thread

  • 104
    Replies
  • 5K
    Views
  • 25
    Participants
Last reply from:
Emorej14324

New Topics

Trending Topics

Online now

Members online
1,092
Guests online
10,459
Total visitors
11,551

Forum statistics

Threads
2,336,217
Posts
29,289,201
Members
1,130,527
Latest member
georgie492
Back
Top