[Solved] Program gives unstable output? [closed]

New code that works: #include <stdio.h> #include <conio.h> #include <string.h> #include <stdlib.h> #include <time.h> int main() { int i,j=0,code,amt, key,lines=0; int id[100],stock[100],k=0; char name[100][20],product[100]; float price[100],sum; float total=0; char ipname[100][20]; int quantity[100], ch; float ipprice[100]; float ipsub[100]; FILE*fp1; fp1=fopen(“Fruit.txt”,”r”); if(fp1==NULL) { printf(“ERROR in opening file\n”); return 1; } else { while((ch=getc(fp1))!=EOF) { if(ch==’\n’) lines++; } … Read more

[Solved] this C++ code always gives same output

#include<iostream> #include<conio.h> using namespace std; int main() { int num; cout<<“Enter a number\n”; cin>>num; int n = num; int rev = 0; while( n >= 1 ) { int rem = n%10; rev = (rev*10) + rem; n=n/10; } cout<<“The reverse of given number is:”<<rev<<endl; if(num==rev) cout<<“The given number and its reverse are equal” << … Read more