PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : wichtige Frage


Gast
2004-01-21, 17:11:48
Hi

Ich will ein Programm programmieren in das ich eine zahl eingeben kann die dann mit 6 dividiert wird.Das Programm soll danach überprüfen ob eine Ganzzahl heraus kommt oder nicht.Kann mir einer sagen wie ich das machen kann am besten ohne Schleifen?

killermaster
2004-01-21, 17:23:10
sprache ?
vbscript

dim a

a=inputbox("bla","bla","bla")

if a mod 6 = 0 then
msgbox "ganz zahl"
else
msgbox "nix da"
end if

mfg

Gnafoo
2004-01-21, 18:18:36
Weil ich grad keine Lust habe, Hausaufgaben zu machen,
das ganze in C++ ;)


#include <iostream>
#include <cmath>
using namespace std;

int main(void)
{
float num;
cin >> num;

if(fmod(num, 6)==0)
cout << "Ganzzahl" << endl;
else
cout << "Keine Ganzzahl" << endl;

return(0);
}


cu Der Tod
PS: habs nicht getestet

Lord Nikon
2004-01-21, 18:23:12
Original geschrieben von Gast
Hi

Ich will ein Programm programmieren in das ich eine zahl eingeben kann die dann mit 6 dividiert wird.Das Programm soll danach überprüfen ob eine Ganzzahl heraus kommt oder nicht.Kann mir einer sagen wie ich das machen kann am besten ohne Schleifen?

in c++:

include <iostream.h>
int main()
{
long zahl,zahl2;
cout <<"Geben Sie eine Zahl ein"<<endl;
cin>>zahl;
zahl2=zahl%6;
if (zahl2==0)
{
cout<<"Teilbar"<<endl;
}
else
{
cout <<"Kommazahl kommt raus"<<endl;
}
return 0;
}


EDIT:
Da war ich wohl ein bisschen zu langsam , weil ich den Code nochmal getestet habe ob er sich kompilieren lässt.

So in Java

import java.io.*;
public class Rechnen
{
public static void main (String [] args)
throws IOException
{
int zahl,zahl2;
BufferedReader din=new BufferedReader(
new InputStreamReader(System.in));
System.out.println("Geben Sie eine Zahl ein");
zahl=Integer.parseInt(din.readLine());
zahl2=zahl%6;
if (zahl2==0)
{
System.out.println("Teilbar");
}
else
{
System.out.println("KOMMAZAHL");
}
}
}
}

killermaster
2004-01-21, 18:55:41
wollen wir das auch ncoh in pascal , javascript machen ?
*Gg*

Lord Nikon
2004-01-21, 18:58:21
Mich würde mal der Code in Assembler intressieren.

killermaster
2004-01-21, 19:03:11
welche arc ?
x86 ?
ppc ?
x85 '?

mfg

killermaster
2004-01-21, 19:09:38
javascript

a=prompt()

b=a%6

if(b==0) { document.write ("ist durch 6 teilbar") ]}
elseif (b>0) { document.write ("nix da")}

mfg

killermaster
2004-01-21, 19:10:34
brauchst du ncoh für php und asp ? :-D

Ganon
2004-01-21, 19:14:46
Wie gibt man sich mit GCC nochmal den Assembler-Code aus? Dann kann ich die PPC-Variante liefern.

zeckensack
2004-01-21, 19:34:48
Mit NASM kompilieren:
SECTION .code

global x86_is_multiple_of_six@4

;prototype:
;bool x86_is_multiple_of_six(int number)

x86_is_multiple_of_six@4:
PUSH EDX
PUSH EBX
MOV EBX,6
XOR EDX,EDX
MOV EAX,[ESP+12]
IDIV EBX
TEST EDX,EDX
SETZ AL
MOVZX EAX,AL
POP EBX
POP EDX
RETN 4
Header dazu:
extern "C"
{
bool __stdcall x86_is_multiple_of_six(int number);
}

Passende Konsolen-Applikation in C++:
#include "den_header_da_oben.h"
#include <iostream>
using namespace std;

int main(void)
{
int number;
cout << "Was?"
cin >> number;

bool woot=x86_is_multiple_of_six(number);
if (woot) cout << "Ja" << endl;
else cout << "Nein" << endl;

return(0);
}Das ASM-modul muss natürlich dazugelinkt werden :naughty:

edit: Sorry, Brainfart im ASM-Teil ... jetzt passt's.

zeckensack
2004-01-21, 19:43:26
Obfuscated:
#include <iostream>

using namespace std;

int main(void)
{
int n;
cout << "Gib her";
cin >> n;
cout << (((n%6)==0)?"Ja":"Nein") << endl;
return(0);
}

Gast
2004-01-21, 20:02:22
Sorry, could not resist :D
warum einfach, wenn es auch kompliziert geht?
(allerdings untested)


#include <iostream>
#include <sstream>
#include <cmath>
using namespace std;

class Exception
{
public:
Exception(string desc)
{
ostringstream strDesc;
strDesc << desc << endl;
mDesc = strDesc.str();
}

string getDescription(void)
{
return(mDesc);
}

protected:
string mDesc;
};

class Divider
{
public:
void tryToDivide(void)
{
if(fmod(mNum, 6)!=0)
throw Exception("Kein ganzzahliges Ergebnis");
}

void setNumber(float num)
{
mNum = num;
}

protected:
float mNum;
};

int main(void)
{
float num;
cin >> num;

Divider div;
div.setNumber(num);

try
{
div.tryToDivide();
cout << "Ganzzahliges Ergebnis" << endl;
}
catch(Exception &rE)
{
cerr << rE.getDescription();
return(1);
}

return(0);
}

Ganon
2004-01-21, 20:28:02
Das komplette Programm im PPC-Assembler. Vielleicht kann es ja jemand auf´s Hauptprogramm kürzen.

Ausgabe von gcc -S main.cpp



.section __TEXT,__text,regular,pure_instructions
.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
.lcomm __ZSt8__ioinit,1,0
.data
.cstring
.align 2
LC0:
.ascii "Gib her\0"
.align 2
LC1:
.ascii "Ja\0"
.align 2
LC2:
.ascii "Nein\0"
.section __TEXT,__text,regular,pure_instructions
.align 2
.align 2
.globl _main
.section __TEXT,__text,regular,pure_instructions
.align 2
_main:
LFB1472:
mflr r0
stmw r30,-8(r1)
LCFI0:
stw r0,8(r1)
LCFI1:
stwu r1,-96(r1)
LCFI2:
mr r30,r1
LCFI3:
bcl 20,31,"L00000000001$pb"
"L00000000001$pb":
mflr r31
addis r2,r31,ha16(L__ZSt4cout$non_lazy_ptr-"L00000000001$pb")
lwz r3,lo16(L__ZSt4cout$non_lazy_ptr-"L00000000001$pb")(r2)
addis r4,r31,ha16(LC0-"L00000000001$pb")
la r4,lo16(LC0-"L00000000001$pb")(r4)
bl L__ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc$stub
addis r2,r31,ha16(L__ZSt3cin$non_lazy_ptr-"L00000000001$pb")
lwz r3,lo16(L__ZSt3cin$non_lazy_ptr-"L00000000001$pb")(r2)
addi r4,r30,64
bl L__ZNSirsERi$stub
lwz r2,64(r30)
lis r0,0x2aaa
ori r0,r0,43691
mulhw r9,r2,r0
srawi r0,r2,31
subf r0,r0,r9
mulli r0,r0,6
subf r0,r0,r2
cmpwi cr7,r0,0
bne cr7,L2
addis r2,r31,ha16(LC1-"L00000000001$pb")
stw r2,68(r30)
lwz r2,68(r30)
la r2,lo16(LC1-"L00000000001$pb")(r2)
stw r2,68(r30)
b L3
L2:
addis r2,r31,ha16(LC2-"L00000000001$pb")
stw r2,68(r30)
lwz r2,68(r30)
la r2,lo16(LC2-"L00000000001$pb")(r2)
stw r2,68(r30)
L3:
addis r2,r31,ha16(L__ZSt4cout$non_lazy_ptr-"L00000000001$pb")
lwz r3,lo16(L__ZSt4cout$non_lazy_ptr-"L00000000001$pb")(r2)
lwz r4,68(r30)
bl L__ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc$stub
mr r0,r3
mr r3,r0
addis r2,r31,ha16(L__ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_$non_laz y_ptr-"L00000000001$pb")
lwz r4,lo16(L__ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_$non_lazy_pt r-"L00000000001$pb")(r2)
bl L__ZNSolsEPFRSoS_E$stub
li r0,0
mr r3,r0
lwz r1,0(r1)
lwz r0,8(r1)
mtlr r0
lmw r30,-8(r1)
blr
LFE1472:
.section __TEXT,__StaticInit,regular,pure_instructions
.align 2
.section __TEXT,__StaticInit,regular,pure_instructions
.align 2
__Z41__static_initialization_and_destruction_0ii:
LFB1482:
mflr r0
stmw r30,-8(r1)
LCFI4:
stw r0,8(r1)
LCFI5:
stwu r1,-80(r1)
LCFI6:
mr r30,r1
LCFI7:
bcl 20,31,"L00000000002$pb"
"L00000000002$pb":
mflr r31
stw r3,104(r30)
stw r4,108(r30)
lwz r0,108(r30)
li r2,0
ori r2,r2,65535
cmpw cr7,r0,r2
bne cr7,L5
lwz r0,104(r30)
cmpwi cr7,r0,1
bne cr7,L5
addis r3,r31,ha16(__ZSt8__ioinit-"L00000000002$pb")
la r3,lo16(__ZSt8__ioinit-"L00000000002$pb")(r3)
bl L__ZNSt8ios_base4InitC1Ev$stub
L5:
lwz r0,108(r30)
li r2,0
ori r2,r2,65535
cmpw cr7,r0,r2
bne cr7,L4
lwz r0,104(r30)
cmpwi cr7,r0,0
bne cr7,L4
addis r3,r31,ha16(__ZSt8__ioinit-"L00000000002$pb")
la r3,lo16(__ZSt8__ioinit-"L00000000002$pb")(r3)
bl L__ZNSt8ios_base4InitD1Ev$stub
L4:
lwz r1,0(r1)
lwz r0,8(r1)
mtlr r0
lmw r30,-8(r1)
blr
LFE1482:
.align 2
.section __TEXT,__StaticInit,regular,pure_instructions
.align 2
__GLOBAL__I_main:
LFB1484:
mflr r0
stmw r30,-8(r1)
LCFI8:
stw r0,8(r1)
LCFI9:
stwu r1,-80(r1)
LCFI10:
mr r30,r1
LCFI11:
li r3,1
li r4,0
ori r4,r4,65535
bl __Z41__static_initialization_and_destruction_0ii
lwz r1,0(r1)
lwz r0,8(r1)
mtlr r0
lmw r30,-8(r1)
blr
LFE1484:
.data
.mod_init_func
.align 2
.long __GLOBAL__I_main
.section __TEXT,__StaticInit,regular,pure_instructions
.align 2
.section __TEXT,__StaticInit,regular,pure_instructions
.align 2
__GLOBAL__D_main:
LFB1486:
mflr r0
stmw r30,-8(r1)
LCFI12:
stw r0,8(r1)
LCFI13:
stwu r1,-80(r1)
LCFI14:
mr r30,r1
LCFI15:
li r3,0
li r4,0
ori r4,r4,65535
bl __Z41__static_initialization_and_destruction_0ii
lwz r1,0(r1)
lwz r0,8(r1)
mtlr r0
lmw r30,-8(r1)
blr
LFE1486:
.data
.mod_term_func
.align 2
.long __GLOBAL__D_main
.data
.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms
EH_frame1:
.set L$set$0,LECIE1-LSCIE1
.long L$set$0
LSCIE1:
.long 0x0
.byte 0x1
.ascii "zPR\0"
.byte 0x1
.byte 0x7c
.byte 0x41
.byte 0x6
.byte 0x90
.long L___gxx_personality_v0$non_lazy_ptr-.
.byte 0x10
.byte 0xc
.byte 0x1
.byte 0x0
.align 2
LECIE1:
.globl main.eh
main.eh:
LSFDE1:
.set L$set$1,LEFDE1-LASFDE1
.long L$set$1
LASFDE1:
.long LASFDE1-EH_frame1
.long LFB1472-.
.set L$set$2,LFE1472-LFB1472
.long L$set$2
.byte 0x0
.byte 0x4
.set L$set$3,LCFI2-LFB1472
.long L$set$3
.byte 0xe
.byte 0x60
.byte 0x11
.byte 0x41
.byte 0x7e
.byte 0x9f
.byte 0x1
.byte 0x9e
.byte 0x2
.byte 0x4
.set L$set$4,LCFI3-LCFI2
.long L$set$4
.byte 0xd
.byte 0x1e
.align 2
LEFDE1:
_Z41__static_initialization_and_destruction_0ii.eh:
LSFDE3:
.set L$set$5,LEFDE3-LASFDE3
.long L$set$5
LASFDE3:
.long LASFDE3-EH_frame1
.long LFB1482-.
.set L$set$6,LFE1482-LFB1482
.long L$set$6
.byte 0x0
.byte 0x4
.set L$set$7,LCFI6-LFB1482
.long L$set$7
.byte 0xe
.byte 0x50
.byte 0x11
.byte 0x41
.byte 0x7e
.byte 0x9f
.byte 0x1
.byte 0x9e
.byte 0x2
.byte 0x4
.set L$set$8,LCFI7-LCFI6
.long L$set$8
.byte 0xd
.byte 0x1e
.align 2
LEFDE3:
_GLOBAL__I_main.eh:
LSFDE5:
.set L$set$9,LEFDE5-LASFDE5
.long L$set$9
LASFDE5:
.long LASFDE5-EH_frame1
.long LFB1484-.
.set L$set$10,LFE1484-LFB1484
.long L$set$10
.byte 0x0
.byte 0x4
.set L$set$11,LCFI10-LFB1484
.long L$set$11
.byte 0xe
.byte 0x50
.byte 0x11
.byte 0x41
.byte 0x7e
.byte 0x9f
.byte 0x1
.byte 0x9e
.byte 0x2
.byte 0x4
.set L$set$12,LCFI11-LCFI10
.long L$set$12
.byte 0xd
.byte 0x1e
.align 2
LEFDE5:
_GLOBAL__D_main.eh:
LSFDE7:
.set L$set$13,LEFDE7-LASFDE7
.long L$set$13
LASFDE7:
.long LASFDE7-EH_frame1
.long LFB1486-.
.set L$set$14,LFE1486-LFB1486
.long L$set$14
.byte 0x0
.byte 0x4
.set L$set$15,LCFI14-LFB1486
.long L$set$15
.byte 0xe
.byte 0x50
.byte 0x11
.byte 0x41
.byte 0x7e
.byte 0x9f
.byte 0x1
.byte 0x9e
.byte 0x2
.byte 0x4
.set L$set$16,LCFI15-LCFI14
.long L$set$16
.byte 0xd
.byte 0x1e
.align 2
LEFDE7:
.data
.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
.align 2
L__ZNSt8ios_base4InitD1Ev$stub:
.indirect_symbol __ZNSt8ios_base4InitD1Ev
mflr r0
bcl 20,31,L0$__ZNSt8ios_base4InitD1Ev
L0$__ZNSt8ios_base4InitD1Ev:
mflr r11
addis r11,r11,ha16(L__ZNSt8ios_base4InitD1Ev$lazy_ptr-L0$__ZNSt8ios_base4InitD1Ev)
mtlr r0
lwzu r12,lo16(L__ZNSt8ios_base4InitD1Ev$lazy_ptr-L0$__ZNSt8ios_base4InitD1Ev)(r11)
mtctr r12
bctr
.data
.lazy_symbol_pointer
L__ZNSt8ios_base4InitD1Ev$lazy_ptr:
.indirect_symbol __ZNSt8ios_base4InitD1Ev
.long dyld_stub_binding_helper
.data
.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
.align 2
L__ZNSt8ios_base4InitC1Ev$stub:
.indirect_symbol __ZNSt8ios_base4InitC1Ev
mflr r0
bcl 20,31,L0$__ZNSt8ios_base4InitC1Ev
L0$__ZNSt8ios_base4InitC1Ev:
mflr r11
addis r11,r11,ha16(L__ZNSt8ios_base4InitC1Ev$lazy_ptr-L0$__ZNSt8ios_base4InitC1Ev)
mtlr r0
lwzu r12,lo16(L__ZNSt8ios_base4InitC1Ev$lazy_ptr-L0$__ZNSt8ios_base4InitC1Ev)(r11)
mtctr r12
bctr
.data
.lazy_symbol_pointer
L__ZNSt8ios_base4InitC1Ev$lazy_ptr:
.indirect_symbol __ZNSt8ios_base4InitC1Ev
.long dyld_stub_binding_helper
.data
.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
.align 2
L__ZNSolsEPFRSoS_E$stub:
.indirect_symbol __ZNSolsEPFRSoS_E
mflr r0
bcl 20,31,L0$__ZNSolsEPFRSoS_E
L0$__ZNSolsEPFRSoS_E:
mflr r11
addis r11,r11,ha16(L__ZNSolsEPFRSoS_E$lazy_ptr-L0$__ZNSolsEPFRSoS_E)
mtlr r0
lwzu r12,lo16(L__ZNSolsEPFRSoS_E$lazy_ptr-L0$__ZNSolsEPFRSoS_E)(r11)
mtctr r12
bctr
.data
.lazy_symbol_pointer
L__ZNSolsEPFRSoS_E$lazy_ptr:
.indirect_symbol __ZNSolsEPFRSoS_E
.long dyld_stub_binding_helper
.data
.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
.align 2
L__ZNSirsERi$stub:
.indirect_symbol __ZNSirsERi
mflr r0
bcl 20,31,L0$__ZNSirsERi
L0$__ZNSirsERi:
mflr r11
addis r11,r11,ha16(L__ZNSirsERi$lazy_ptr-L0$__ZNSirsERi)
mtlr r0
lwzu r12,lo16(L__ZNSirsERi$lazy_ptr-L0$__ZNSirsERi)(r11)
mtctr r12
bctr
.data
.lazy_symbol_pointer
L__ZNSirsERi$lazy_ptr:
.indirect_symbol __ZNSirsERi
.long dyld_stub_binding_helper
.data
.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
.align 2
L__ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc$stub:
.indirect_symbol __ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
mflr r0
bcl 20,31,L0$__ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
L0$__ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc:
mflr r11
addis r11,r11,ha16(L__ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc$lazy_ptr-L0$__ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc)
mtlr r0
lwzu r12,lo16(L__ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc$lazy_ptr-L0$__ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc)(r11)
mtctr r12
bctr
.data
.lazy_symbol_pointer
L__ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc$lazy_ptr:
.indirect_symbol __ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.long dyld_stub_binding_helper
.data
.non_lazy_symbol_pointer
L___gxx_personality_v0$non_lazy_ptr:
.indirect_symbol ___gxx_personality_v0
.long 0
L__ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_$non_lazy_ptr:
.indirect_symbol __ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.long 0
L__ZSt3cin$non_lazy_ptr:
.indirect_symbol __ZSt3cin
.long 0
L__ZSt4cout$non_lazy_ptr:
.indirect_symbol __ZSt4cout
.long 0
.data
.constructor
.data
.destructor
.align 1

killermaster
2004-01-21, 20:28:46
ich glaub kaum ,dass einer von uns den code getestet hat..

Gast
2004-01-21, 20:34:52
THX an alle das ihr mir geholfen habt

killermaster
2004-01-21, 20:40:18
nun sollst du uns zumindest mal sagen, in welcher programmiersprache das sein soll oder ?!?!
mfg

HellHorse
2004-01-22, 05:31:21
So, jetzt mal in PROLOG

run :-
write('Geben sie die Zahl ein'), nl,
read(X),
Y is X mod 6,
Y == 0,
write('Die Zahl ist durch 6 teilbar'),
ttyflush.

run :-
write('Die Zahl nicht ist durch 6 teilbar'),
ttyflush.

Getestet und läuft =)

killermaster
2004-01-22, 07:59:08
wo setzt man diese sprache ein ??
mfg

littlejam
2004-01-22, 09:52:47
Überall da, wo Geschwindigkeit nicht wichtig ist und man wissen möchte ob Peter mit Lisa verwandt ist:D

Gruß

killermaster
2004-01-22, 10:10:29
jemand für qbasic ?

HellHorse
2004-01-22, 12:03:05
hier noch mal eine "kompilizierte" Version in Java, die den Input überprüft und ein optionales GUI hat

import javax.swing.*;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;

public class Modulo {
private static String inputString = "Geben Sie eine Zahl ein";

private static String divisibleMessage = "die Zahl ist durch 6 teilbar";

private static String undivisibleMessage = "die Zahl ist nicht durch 6 teilbar";

private static String inputError = "Bitte geben sie eine Ganzzahl ein: ";

private static boolean useGui;

private static void divisibleMessage() {
message(divisibleMessage);
}

private static void undivisibleMessage() {
message(undivisibleMessage);
}

private static void message(String message) {
if (useGui) {
JOptionPane.showMessageDialog(null, message);
} else {
System.out.println(message);
}
}

private static void inputErrorMessage() {
if (useGui) {
JOptionPane.showMessageDialog(null, inputError);
} else {
System.out.println(inputError);
}
}

private static void setOptions(String[] args) {
for (int i = 0; i < args.length; ++i) {
if (args[i].equals("-g")) {
useGui = true;
} else if (args[i].equals("-ng")) {
useGui = false;
} else if (args[i].equals("--help")) {
System.out.println("Verfügbare Optionen:\n"+
"-g aktiviert GUI, überschreibt vorhergehendes -ng"+
"-ng deaktiviert GUI, überschreibt vorhergehendes -g"+
"--help gibt diese Nachricht aus");
}
}
}

private static String readInput() {
String message = null;
if (useGui) {
message = JOptionPane.showInputDialog(inputString);
} else {
System.out.print(inputString+": ");
BufferedReader din =new BufferedReader(
new InputStreamReader(System.in));
try {
message = din.readLine();

} catch (IOException e) {
System.out.println("Oops, wir können nicht von der Konsole lesen.");
} finally {
try {
din.close();
} catch (IOException e) {
System.out.println("Der InputStream konnte nicht geschlossen werden.");
}
}
}
return message;
}

public static void main (String[] args) {
setOptions(args);
interact();
System.exit(0);
}

private static void interact() {
String inputString = readInput();
int inputInt = 0;
if (inputString != null) { //if we didn't have a problem when reading from console
while (true) { // loop until the user input is an integer
try {
inputInt = Integer.parseInt(inputString);
break;
} catch (NumberFormatException e) {
inputErrorMessage();
}
inputString = readInput();
} // while (true)
if (inputInt % 6 == 0) {
divisibleMessage();
} else {
undivisibleMessage();
}
} // if (inputString != null) {
}
}


So jetzt noch in Sqeak:

| answer |
answer := FillInTheBlank request: 'Geben sie eine Zahl ein'.
(answer\\6 == 0) ifTrue: [
Transcript show: 'Die Zahl ist durch 6 teilbar.']
ifFalse: [
Transcript show: 'Die Zahl ist nicht durch 6 teilbar'].
Transcript cr.

Gnafoo
2004-01-22, 12:36:02
Python sollte auch nicht fehlen:


num = input()

if num%6 == 0:
print "Ganzzahliges Ergebnis"
else:
print "Keine Ganzzahl"


cu DerTod :)
PS: sollte der Thread jetzt nicht in die Spielwiese ? :D

Harleckin
2004-01-22, 13:40:33
Eine Lösung von mir in AppleScript:

set foo to display dialog "Eine Wurstzahl, bitte!" default answer ""
set num to text returned of foo
if (num / 6) mod 1 as text is "0,0" then
display dialog "Ganzzahliges Ergebnis."
else
display dialog "Keine Ganzzahl."
end if

HellHorse
2004-01-22, 13:48:46
Original geschrieben von littlejam
Überall da, wo Geschwindigkeit nicht wichtig ist und man wissen möchte ob Peter mit Lisa verwandt ist:D

Gruß
Kommt darauf an, was man mit Geschwindigkeit meint.
Zeit, die das Programm zur Ausführung braucht oder
Zeit, die die Entwicklung des Programmes braucht.

beta3
2004-01-22, 14:49:34
mach auch mit :D

c#

using System;

static void Main(){
Console.Writeline("Bitte Zahl eingeben");
double num = Console.Readline();

if ((num%6) == 0)
Console.Writeline("Ganzzahliges Ergebnis");

else
Console.WriteLine("keine Ganzzahl");
}

Tom Servo
2004-01-22, 17:45:15
(defun vielfaches-von-sechs (n)
"Emacs Lisp"
(interactive "nZahl eingeben: ")
(cond
((zerop (% n 6)) (print "Vielfaches von Sechs") t)
(t (print "Kein Vielfaches von Sechs") nil)))

ethrandil
2004-01-22, 20:02:10
Java:


System.out.println(
(Integer.parseInt(
new BufferedReader(
new InputStreamReader(System.in)).readLine()
)%6==0)?
"teilbar":
"nicht teilbar");
Warum lang wenns auch kurz geht? *gg*

killermaster
2004-01-22, 20:09:41
anscheinend haben wie viele java kenner hier .
*Gg*

sprachen wie VB scheinen ausgestorben zu sein
*gg*

ethrandil
2004-01-22, 20:16:34
Original geschrieben von rapmaster
sprachen wie VB scheinen ausgestorben zu sein
*gg*
Hätt ich jetzt so spontan überhaupt kein Problem mit *gg*

Darkstar
2004-01-22, 21:46:28
Pascal
var
Zahl: Integer;

begin
Write('Zahl her, aber dalli! ');
ReadLn(Zahl);
if (Zahl mod 6) = 0 then
Write('Yo!')
else
Write('Nö, will ich nicht!');
end.

Xmas
2004-01-23, 01:31:58
Original geschrieben von ethrandil
Warum lang wenns auch kurz geht? *gg*
Na wenn du es ganz kurz haben willst...

print ["nicht teilbar", "teilbar"][input()%6 == 0]

Gast
2004-01-23, 09:33:06
Perl:
#!/usr/local/bin/perl
if ($ARGV[0] % 6 > 0) {
print "nöööö\n";
}
else {
print "yep\n";
}

Gast
2004-01-23, 13:10:44
+++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[[
>>>>>>>>>]+[<<<<<<<<<]>>>>>>>>>-]+[>>>>>>>>[-]>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>[-]+
<<<<<<<+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>
>+<<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+[>>>>>>[>>>>>>>[-]>>]<<<<<<<<<[<<<<<<<<<]>>
>>>>>[-]+<<<<<<++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<+++++++[-[->>>
>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[[-]>>>>>>[>>>>>
>>[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<+<<<+<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>>
[>>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->>>>>>>+<<+<<<+<<]>>>>>>>>]<<<<<<<<<[<<<<<<<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->>>>>>>>+<<<<<<<<<<<<<<<<<[<<<<<<<
<<]>>>>[-]+>>>>>[>>>>>>>>>]>+<]]+>>>>>>>>[-<<<<<<<<->>>>>>>>]+<<<<<<<<[->>>>>>>>
-<<[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+>>>>>>[>>>>>>
>>>]>[-]+<]]+>[-<[>>>>>>>>>]<<<<<<<<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>[-]<<<++++
+[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>->>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<[<<<<
<<<<<]]>>>]

zeckensack
2004-01-23, 13:39:21
Ah, da spricht jemand Brainfuck (http://www.muppetlabs.com/~breadbox/bf/) :)

killermaster
2004-01-23, 14:03:19
lol

ScottManDeath
2004-01-23, 16:03:35
.....gut, als Fragment Programm, aka Pixel Shader. ;D
Prüft ob die s-Texturcoordinate durch 6 teilbar ist, wenn ja ist der Pixel weiss, ansonsten schwarz. Das Vertexprogramm hab ich aud faulheit weggelassen


!!ARBfp1.0
PARAM c0 = {1, 1, 1, 1};
PARAM c1 = {0, 0, 0, 1};
PARAM c2 = {6, 0.16666667, 0, 0};
TEMP R0;
TEMP R1;
TEMP H0;
MOV H0.x, c1.x;
MUL R0.x, fragment.texcoord[0].x, c2.y;
ABS R0.x, R0.x;
FRC R0.x, R0.x;
MUL R0.x, R0.x, c2.x;
ADD R0.y, fragment.texcoord[0].x, -c1.x;
CMP H0.x, R0.y, c0.x, H0.x;
CMP R0.x, -H0.x, -R0.x, R0.x;
MOV R1, c1;
CMP R0.x, -R0.x, c0, R1;
MOV result.color.x, R0.x;
END



der cg code ( ich war zu faul "im Kopf" zu compilen..... :D

float main ( in float number: TEXCOORD0) : COLOR
{

return fmod(number,6.0f) ? float4(1.0f,1.0f,1.0f,1.0f) : float4(0.0f,0.0f,0.0f,1.0f);
}

Marcel
2004-01-23, 16:21:48
Original geschrieben von littlejam
Überall da, wo Geschwindigkeit nicht wichtig ist und man wissen möchte ob Peter mit Lisa verwandt ist:D

Gruß

;D
Wie wahr, wie wahr!!

killermaster
2004-01-23, 16:28:39
Überall da, wo Geschwindigkeit nicht wichtig ist und man wissen möchte ob Peter mit Lisa verwandt ist <= ehrlichgesagt versteh ich den satz nicht...

Gnafoo
2004-01-23, 16:45:23
whitespace (http://compsoc.dur.ac.uk/whitespace/) :D
mit Textausgabe













































ich hoffe es sind keine spaces und tabs verloren gegangen.

edit: uuencoded, weil es ja sonst doch net klappt :D
begin 644 test.ws
M("`@"2`)(`H@("`)"2`)"2`@"B`@(`D)(`D@("`*("`@"0D@("`@"0H@("`)
M"0D)(`D@"B`*("`@(`D)(`D)"2`*("`@"0D@("`@"0H@("`)("`@"0D)"B`@
M("`)"B`*(`D*"0D)"0D@("`)"2`*"2`)"0H)("`*("`@"2`@("`@"B`@(`D)
M("`)(`D*("`@"0D@"0D)(`H@("`)"2`)("`)"B`@(`D)("`)(`D*("`@"0D@
M"2`)"0H)"B`@"0H@(`D*("`)"B`@"0H@(`D*("`*("`@"@D*("`)"B`@"0H@
=(`D*("`)"B`@"0H@(`D*("`)"B`@"0H@(`H*"@H`
`
end


in datei speichern und:
uudecode [file]

dann die test.ws per interpreter ausführen :D

cya DerTod

HellHorse
2004-03-22, 21:01:07
Scheme

(display (if (= 0 (modulo (read) 6)) "teilbar" "nicht teilbar"))

marco42
2004-03-22, 22:15:25
Das ganze in Python:

if not divmod(input("gib die zahl ein: "), 6)[1]: print "ist eine Ganzzahl"

Ist aber nicht perfekt, da es nicht alle dummen Eingaben abfaengt.

Trap
2004-03-22, 22:52:05
Ich hab noch eins in Erlang:

mod6() -> A = io:fread('Zahl eingeben: ',"~d"),
case A of
{ok,[I|_]} -> isnull(I rem 6);
{error,_} -> mod6()
end.

isnull(0) -> true;
isnull(N) -> false.

mod6().

Xmas
2004-03-22, 22:59:30
Original geschrieben von marco42
Das ganze in Python:

if not divmod(input("gib die zahl ein: "), 6)[1]: print "ist eine Ganzzahl"

Ist aber nicht perfekt, da es nicht alle dummen Eingaben abfaengt.
Warum divmod wenn es doch % in Python gibt? Damit man auch ja eine Exception bekommt falls einer doch mal "%d" eingeben sollte? ;)

marco42
2004-03-23, 02:52:54
Original geschrieben von Xmas
Warum divmod wenn es doch % in Python gibt? Damit man auch ja eine Exception bekommt falls einer doch mal "%d" eingeben sollte? ;)

Hmm, geht beides, ich benutze gern divmod, da ich meistens beides brauche. War ein purer Reflex. Ich wollte es ja erst mit future divisions machen. Aber die werfen immer ein float zurueck. Der Code ist ja sowieso ueberhaus haesslich, voellig unPythonic. :-)

Na, vielleicht sollte ich noch ein GLSlang Beispiel hacken. :-)

PaYa.MooN
2004-03-25, 15:23:38
Hier mal in QB (ungetestet)


CLS
INPUT "Bitte Zahl eingeben! ",z
IF z MOD 6 = 0 THEN PRINT "teilbar" ELSE PRINT "nicht teilbar"
END