Skip to main content

Posts

Showing posts with the label c program armstrong number

Sample C Program For Armstrong Numbers

7) Sample C Program to print sum of individual digits of given number. # include <stdio.h> # include <conio.h> main( ) { int a, b, c, d; clrscr( ); printf ( "Enter any two digit number :"); scanf ("%d", &a); b = a / 10; c = a % 10; d = b + c; printf ("Sum of individual digits of given numbers is %d", d); getch( ); } 8) Sample C Program Program to accept a three digit number and print the sum of individual digits. # include <stdio.h> # include <conio.h> main( ) { int a, b, c, n, sum; clrscr( ); printf ("Enter a Three Digit Number:"); scanf ("%d",&n); a = n / 100; b = ( ( n % 100 ) / 10 ); c = n % 10; sum = a + b + c; printf ("Sum of Individual Digits of Given Numbers is %d", Sum); getch( ); } 9. Sample C Program to accept a number and check the given number is Armstrong or not. # include <stdio.h> # include <conio.h> main( ) { int n,...