Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Lab 6 mb
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//gcc 5.4.0 //int n; Example //int d; //READ n n=153 //int nn=n; nn=153 //int sum=0; sum=0 //WHILE (n>0){ when n is greater than 0 run loop // d=n%10; find remainder of n 1.3 2.5 3.1 // sum+=(d*d*d); find cube of remainders 1.9 2.125 3.1 and add them to sum=153 // n=n/10; divide n by 10 to remove cycle through place values //} //if n=sum set of if statements if nn(the original input)=sum the entered value is an armsrong number the program prints that it is // PRINT nn is an armstrong number if the sum doesn't equal the original input the program prints that the number wast an armstrong number. //if n!=sum // PRINT nn is not an armstrong number #include <stdio.h> int main(void) { int n; int d; scanf("%d",&n); int nn=n; int sum=0; //printf("%d\n",nn); while(n>0){ d=n%10; sum+=(d*d*d); n=n/10; } // printf("%d\n",nn); if(nn==sum) printf("%d is an armstrong number!",nn); if(nn!=sum) printf("%d isn't an armstrong number :(",nn); }
gcc
153
Show compiler warnings
[
+
] Compiler args
[
-
]
Show input
Compilation time: 0.12 sec, absolute running time: 0.14 sec, cpu time: 0 sec, memory peak: 3 Mb, absolute service time: 0,35 sec
fork mode
|
history
|
discussion