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; }
2 Antworten
+ 1
What's your expected output and what is the output you're getting?
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..