answersLogoWhite

0


Best Answer

TO PRINT ALPHABET PYRAMID

ABCDEFGGFEDCBA

ABCDEFFEDCBA

ABCDEEDCBA

ABCDDCBA

ABCCBA

ABAB

A

#include

#incldue

int main( )

{

int r,c,askey,sp;

clrscr( );

for( r=7; r>=1; r-- )

{

for(sp=6; sp>=r; sp--)

printf(" "); //2 spaces

askey=65;

for(c=1; c<=r; c++ )

printf("%2c", askey++ );

for(c=r-1; c>=1; c-- )

printf("%2c", --askey);

printf("\n");

}

getch();

return 0;

}

by BRAMHA VARDHAN

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

#include
main()
{
int number, temp, digit1, digit2, digit3;

printf("Printing all Armstrong numbers between 1 and 500:\n\n");

number = 001;

while (number <= 500)
{
digit1 = number - ((number / 10) * 10);

digit2 = (number / 10) - ((number / 100) * 10);

digit3 = (number / 100) - ((number / 1000) * 10);

temp = (digit1*digit1*digit1) + (digit2*digit2*digit2) + (digit3*digit3*digit3);

if (temp == number)
{
printf("\nAmstrong Number:%d", temp);

}

number++;
}
}

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

#include<stdio.h> #include<conio.h> #include<math.h> int armstrong(int num) { int i,c=0,arm=0; int ar[100]; for(i=0;i<100;i++) { ar[i]=0; } while(num>0) { ar[c]=num%10; c++; num/=10; } for(i=1;i<c;i++) { arm+=pow(ar[i],3); } return arm; } void main() { clrscr(); int n,a=0; printf("\n Enter the number: "); scanf("%d",&n); a=armstrong(n); printf("\n The number %d is",n); if(n==a) printf(" armstrong number"); else printf(" not an armstrong number"); getch(); }

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

This site is not for home-works, it is for questions.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a c program to check Armstrong number using functions?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a java program to check a number is Armstrong number?

import java.io.*; public class Jerry { public static void main(String as[]) throws IOException { int k=Integer.parseInt(as[0]); int n=k; int d=0,s=0; while(n&gt;0) { d=n%10; s=s+(d*d*d); n=n/10; } if(k==s) System.out.println("Armstrong number"); else System.out.println("not Armstrong number"); } }


Write a program to illustrate the usage of pointers with arrarys and functions?

* * * * * * * * * * write the c++ program and show me brifily?


How do you write a program in C using the fprint and fscan functions?

By using those two functions in your code.


How do you write c program to perform sum of elements of matrix using pointers with functions?

i cant write


Write a program to convert a 2 digit BCD number into hexadecimal number?

Write a program to convert a 2-digit BCD number into hexadecimal


What is the importance of functions in a c plus plus program?

Functions are very important in C++, as you can't write the simplest program to print hello without using a function. Overall you can say that function are building blocks of a C++ program. Functions can also be defined by the programmer to reduce program size.


Write C program using functions to simulate a Calculator with the basic functions - square root and reciprocal?

trytytytytytytytytrf 6 bcvvtgujhy6


How many essential functions are required to write a c program and write those?

One.int main (void) { return 0; }


How do you write a Java program to see whether a number is Armstrong or not... using Buffered Reader and stuff ....?

import java.io.*; class Armstrong { public static void main()throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter a number"); int a=Integer.parseInt(in.readLine()); int n1=a,rev=0,d=0; while(a!=0) { d=a%10; rev=rev+d*d*d; a=a/10; } if(rev==n1) System.out.println("It is a armstrong number "); else System.out.println("It is not a armstrong number "); } }


Why we write java program using classes?

Classes are well organised functions in java which help discriminate between two different functions.


How do you write a java program for finding multiligual languages?

You can use Java's built-in functions to write a code that will find multilingual languages.


2 Write a program to convert a 2-digit BCD number into hexadecimal?

WRITE A PROGRAM TO CONVERT A 2-DIGIT bcd NUMBER INTO HEXADECIMAL