0

What is the error in it

#include<stdio.h> int main() { int n=1,i,even,odd,large=1,small=1,r; printf("enter the number of terms"); scanf("%d",&n); printf("enter the numbers"); for(i=1;i<n;i++) { scanf("%d",&r); { if((r&1)==0) {r=even; if(even>large) even=large; } else {r=odd; if(odd<small) odd=small; } } } printf("the smallest odd number is %d",small); printf("the largest even number is %d",large); return 0; }

24th Mar 2020, 7:44 AM
Binu Lal K T
Binu Lal K T - avatar
2 Antworten
+ 1
What's your expected output and what is the output you're getting?
24th Mar 2020, 9:29 AM
✳AsterisK✳
✳AsterisK✳ - avatar
0
You are using even odd variables before assigning value.. It's give warnings garbage values.. Please specify problem clearly.. So you get correct solutions..
24th Mar 2020, 10:02 AM
Jayakrishna 🇮🇳