Hemant
BAN USERComplete Code:
#include<conio.h>
#include<iostream>
using namespace std;
void main()
{
int max[3]={0,0,0};
float avg=0,sum=0;
int count=0,num;
cin>>num;
while(num !=0)
{
count++;
if(num<max[1] && num>=max[2])
{
max[2]=num;
}
if(num<max[0] && num>=max[1])
{
max[2]=max[1];
max[1]=num;
}
if(num>=max[0])
{
max[2]=max[1]; //shifting
max[1]=max[0];
max[0]=num;
}
sum += num;
cin>>num;
}
cout<<"\nno of elements= "<<count;
if(count>3)
avg=(sum-max[0]-max[1]-max[2])/(count-3);
cout<<"\n first max= "<<max[0];
cout<<"\n second max= "<<max[1];
cout<<"\n third max= "<<max[2];
cout<<"\n avg= "<<avg;
getch();
}
RepTaylahMacge, Consultant at Accenture
Assigned to manage the requirements of foreign clients specifically those from the Chinese, Arabic, and French-speaking markets.I am passionate ...
void palindrome_32bit_no()
- Hemant March 27, 2010{
unsigned long int x=0xFCA88ACF,A,B;
int i=0,flag=0;
for(i=0;i<16;i++)
{
A=(x & (unsigned long)pow(2.0, 32-i-1) );
B=(x & (unsigned long)pow(2.0, i) );
if((A && B)|| (!A && !B))
flag=1;
else
{
flag=0;
cout<<"\nThe no is not palindrome";
break;
}
}
if(flag==1)
cout<<"\nPalindrome";
}