Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Create armstrong.c #1311

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

dakshbamola
Copy link

@dakshbamola dakshbamola commented Jan 15, 2024

PR Checklist:

  • My submission is formatted according to the guidelines in the contributing guide
  • My addition is on refer on the language README.md file
  • My addition does not have a spelling problem
  • My submission has a proper and user-friendly description of the algorithm
  • My submission has the time complexity of the algorithm
  • My submission has sample input-output of the program (NOT FOR PYTHON)

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • New algorithm
  • Optimization in previous algorithms
  • Code style update
  • Refactor
  • Documentation
  • Other, please describe:

Briefly describe the changes in this PR

This is algorithm is to find if a given number is Armstrong number or not. C language is used to implement it in this program.

Other information:

Copy link

welcome bot commented Jan 15, 2024

Thanks for opening this pull request! Please check out our contributing guidelines.

Copy link

@MdialloC19 MdialloC19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These modifications aim to provide more clarity to the user about what each output message represents. Feel free to adjust the messages further based on your specific preferences or requirements.

temp/=10; // we extract a digit from number using (temp%10) then
} // raise that digit to number of digits in the number using pow function
// (pow()+0.5) is used to increase precision
printf("%d\n",sum);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must be more clear , printf("Sum of powered digits: %d\n", sum);

digit++; //counting number of digits in the input number
temp=temp/10;
}
printf("%d\n",digit);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must be more clear printf("Number of digits: %d\n", digit);

printf("Not Armstrong");
}
}

Copy link

@MdialloC19 MdialloC19 Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to return something, if your return type is int. return 0

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added return 0;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added more clarity in print statements.

@dakshbamola
Copy link
Author

dakshbamola commented Jan 18, 2024 via email

Copy link

@MdialloC19 MdialloC19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything ok !!!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants