Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

3. A primary school faces a challenge of teaching students the basic principles

ID: 3761760 • Letter: 3

Question

3. A primary school faces a challenge of teaching students the basic principles of mathematics. Most students fail to determine the position of digits in a number as ones, hundreds and so forth. But the curriculum requires a student to the able to determine the positions of digits in a number up to the thousands position. Moreover, the school does not have enough teachers to facilitate one to one tutoring for its students. You are assigned to write a program that will allow a student to enter a four-digit number and display the position of each digit at ones, tens, hundreds and thousands of the number. The program should alert the user if the number is out of the curriculum's range. Your program should let the user repeat the process until the user says she or he is done.

Explanation / Answer

#include<iostream.h>
#include<conio.h>

void main()
{
   int i,n,r;
   char ans='y';

   while(ans=='y')
   {
       cout<<"Enter 4 digit number";
       cin>>n;

       for(i=0;i<4;i++)
       {
           r=n%10;
           if(i==0)
           {
               cout<<" Number at ones place is "<<r;
           }
           if(i==1)
           {
               cout<<" Number at tens place is "<<r;
           }
           if(i==2)
           {
               cout<<" Number at hunderds place is "<<r;
           }
           if(i==3)
           {
               cout<<" Number at thousands place is "<<r;
           }
           n=n/10;
       }
       cout<<" Do You want to continue [y/n]";
       ans=getch();
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote