Create a free account on Computer Sir Ki Class and unlock access to valuable learning resources.
Exam Paper Downloads: After registering and logging in, you can download exam question papers in PDF format to practice and prepare for your exams.
Student Support: Get assistance with your doubts, queries, and questions related to your studies. Our support is here to help you understand topics and resolve your learning difficulties.
Register today and make your exam preparation easier and more effective!
Find and write the output of the following C++ program code: Note: Assume all required header files are already being included in the program.
void main()
{
int *Point, Score[]={100,95,150,75,65,120};
Point = Score;
for(int L = 0; L<6; L++)
{
if((*Point)%10==0)
*Point /= 2;
else
*Point -= 2;
if((*Point)%5==0)
*Point /= 5;
Point++;
}
for(int L = 5; L>=0; L--)
cout<<Score[L]<<"*";
}
Notes:
int *Point, Score[]={100,95,150,75,65,120};
*Point is an integer poiner and Score is an integer array with 6 members.
Point = Score;
Point an integer pointer contains address of first location of Score.
for(int L = 0; L<6; L++) {
Array is traversed in forward direction
if((*Point)%10==0) *Point /= 2;
If value at any array member is divisible by 10 make it half.
else *Point -= 2;
Otherwise make it 2 less (*Point here can be read as value at given array member)
if((*Point)%5==0) *Point /= 5;
After above check further check if the modified value is divisible by 5 divide it further by 5
Point++; }
Point to next array member.
After first for loop the array will become
10, 93, 15, 73, 63, 12 Based on the logic given above
for(int L = 5; L>=0; L–) cout<<Score[L]<<“*”;
Just print the array in reverse order with a following * . So the output would be
12*63*73*15*93*10*
C. Sir| Created: 6-Dec-2018 | Updated: 22-Mar-2026|CBSE12A-2017