Professional Documents
Culture Documents
Write a program to ,
1x5=5
2 x 5 = 10
...
...
10 x 5 = 50
10 x 9 = 90
9 x 9 = 181
..
..
1x9=9
1
4. In a contest , 20 questions are given. 5 point is given for each correct answer for the
odd number question and 3 point is given for each correct answer for the even
numbered question.Write a program segment to input the answer : C for correct
answer and W for wrong answer, and determine the total point the contestants
received.
6. Write a program to calculate the average of numbers within the given two
integers.For example,if the numbers are 3 and 7,the average value is 5 which
is calculated from ( 4+5+6)/3.
13. Without using division operator %,write a complete program using C++ to
find the divison and the remainder when dividing two positive integer
numbers.Display the value of quotient and the remainder.Make sure the divisor is
not zero.Display an appropriate message if the divisor is zero.
2
ANSWER:
QUESTION 1 (a)
#include<iostream>
#include<math.h>
int main()
{
int num = 0 ;
return 0 ;
3
QUESTION 1 (b)
#include<iostream>
#include<math.h>
int main()
{
int num = 1 ;
return 0 ;
4
QUESTION 1 (c)
#include<iostream>
#include<math.h>
int main()
{
int num = 100 ;
return 0 ;
5
QUESTION 1 (d)
#include<iostream>
#include<math.h>
int main()
int product;
{
product = number * num;
cout<<number<<"*"<<num<<"="<<product<<endl;
}
return 0;
QUESTION 1 (e)
#include<iostream>
#include<math.h>
int main()
while (number != 0)
{
product = number * 9;
cout<<number<<"*"<<num<<"="<<product<<endl;
number--;
}
return 0;
QUESTION 1 (f)
#include<iostream>
#include<math.h>
int main()
do
{
cout<<num<<", ";
num = num + 2;
}
while ( num <= 1998 );
return 0;
}
8
QUESTION 1 (g)
#include<iostream> 9
#include<math.h>
int number;
int sum = 0;
if (number%2 != 0)
sum = sum + number;
return 0;
QUESTION 4
#include <iostream>
10
{
int ques = 1;
int point = 0;
char ans;
else
{
point= point;
}
}
else
{
cout<<"Question"<<ques<<"=";
cin>>ans;
}
ques++;
}
cout<<"Your total point
11 is ="<<point<<endl;
return 0;
}
cout<<" Total point: "<<point;
return 0;
}
QUESTION 6
12
#include<iostream>
#include<math.h>
using namespace std;
int main ()
{
int count = 0, integer, number;
float average, min = 100.0, max = 0.0, total = 0.0;
{
cout<<"ENTER THE INTEGER: ";
cin>>number;
return 0;
}
13
QUESTION 13
#include<conio.h>
#include<math.h>
14
int main ()
{
int number, divisor, quotient = 0;
if (divisor != 0)
{
while (number >= divisor)
{
number = number - divisor;
quotient += 1;
}
cout<<"ANSWER: "<<quotient<<endl;
cout<<"REMINDER: "<<number<<endl;
else
{
cout<<"INFINITY. PLEASE TRY AGAIN";
}
return 0;
}
15
16
17
18