Computer Science, asked by arpitabarik20066, 1 year ago

1. Write a program in C++ to enter any 3 digit number and find the product of the first and the last digit.

Answers

Answered by Anonymous
3

Answer:

Logic to find sum of first and last digit using loop

Logic to find sum of first and last digit using loopInput a number from user. ...

Logic to find sum of first and last digit using loopInput a number from user. ...To find last digit of given number we modulo divide the given number by 10 . ...

Logic to find sum of first and last digit using loopInput a number from user. ...To find last digit of given number we modulo divide the given number by 10 . ...To find first digit we divide the given number by 10 till num is greater than 0 .

Logic to find sum of first and last digit using loopInput a number from user. ...To find last digit of given number we modulo divide the given number by 10 . ...To find first digit we divide the given number by 10 till num is greater than 0 .Finally calculate sum of first and last digit i.e. sum = firstDigit + lastDigit .

Answered by intelligentpriya
1

Answer:

Simply you have to follow this.....⬇️⬇️

#include <iostream>

using namespace std;

int main()

{

int n,first,last,sum;

cout << "\n\n Find the sum of first and last digit of a number:\n";

cout << "------------------------------------------------------\n";

cout << " Input any number: ";

cin >> n;

first = n;

last=n % 10;

for(first=n;first>=10;first=first/10);

cout<<" The first digit of "<<n<<" is: "<<first<<endl;

cout<<" The last digit of "<<n<<" is: "<<last<<endl;

cout<<" The sum of first and last digit of "<<n<<" is: "<<first+last<<endl;

}

Hope it helps...☺️☺️

Please mark me as a brainlist..

Similar questions