Professional Documents
Culture Documents
QUESTION #1
Write a function called zero_small() that has two integer arguments being passed by
reference and sets the smaller of the two numbers to 0. Write the main program to
access the function.
SOLUTION
Source Code
#include<iostream>
using namespace std;
int main()
{
int x,y;
cout<<"Enter first number : ";
cin>>x;
cout<<"Enter second number : ";
cin>>y;
zero_small(x,y);
cout<<"First number is : "<<x;
cout<<"\nSecond number is : "<<y;
return 0;
}
Output
SAMPLE RUN # 1
Question #2 write a program to check a string is palindrome or not by using DEV c++
SOLUTION
#include <iostream>
using namespace std;
int main(){
char string1[20];
int i, length;
int flag = 0;
length = strlen(string1);
if (flag) {
cout << string1 << " is not a palindrome" << endl;
}
else {
cout << string1 << " is a palindrome" << endl;
}
system("pause");
return 0;
}