Computer Science, asked by raimaghoshslg, 15 days ago

Write a program to input 10 no.s and print the first digit of all 3- digit no. using while loop c++​

Answers

Answered by jenidass28
1

Answer:

Explanation:

#include<iostream>

using namespace std;

int main()

{

int n=10,sum=0,number;

cout<<"\n Enter numbers:";

while(n>0)

{

 cin>>number;

 sum+=number;

 n--;

}

 if(number>99 && number<1000)

        cout<<"number"

return 0;

}

Answered by samarthkrv
2

Answer:

#include <iostream>

using namespace std;

int main()

{

   int arr[10];

   cout << "Enter all 10 numbers- \n";

       for(int i = 0; i < 10; i++){

           cin >> arr[i];

       }

   int i = 0;

       while(i < 10){

           if(arr[i] >= 100 && arr[i] <= 900){

               cout << arr[i] << " is a 3 digit number and the first digit is " << (int)arr[i]/100 << "\n";

           }

           i++;

       }

   return 0;

}

Explanation:

Similar questions