C -Code zum Java -Konverter
#include <stdio.h>
Tumbling Helmet
#include <stdio.h>
#include<stdio.h>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;
int main(){
int i;
double l,sum;
char s[31];
while(gets(s)&&strcmp(s,"0") != 0)
{
l=strlen(s);
sum=0;
for(i=0;i<strlen(s);i++,l--)
sum=sum+(s[i]-'0')*(pow(2,l)-1);
cout<<int(sum)<<endl;
}
return 0;
}
#include<stdio.h>
int main (void){
int distance, d1;
float fee;
printf("Enter distance travelled:");scanf("%d", & distance),
fees=0;
if(distance>=300){
distance=distance-300;
fee=20.00;
if(distance> 208){
d1=distance/200;
fee-fee+2.00*d1;
distance=distance-d1*200;
Jif(distance>0){
fee=fee+2.00;
Jelse if(distance>200){
distance=distance-200;
fee=2.00;
if(distance>0){
fee=fee+2.00;
Jelse(
fee=2.00;)
printf("Fare=%.2f", fee);
return 0;
void prReplyException(char*errCode, char*errText)
{
smne_reply_Error_def smneasnReply;
short rc;
char error_exception_code[50];
char error_description[80];
char logTxt[90];
short chcnt=0;
msgTxtDef
void rainbow_loop() { //2
idex++;
ihue = ihue + 10;
if (idex >= LED_COUNT/LED_FIZLINE) {
idex = 0;
}
if (ihue > 255) {
ihue = 0;
}
hsv_to_rgb(ihue*100, thissat, 255, leds[idex]);
LEDSshow();
}
void main()
{
int a,b,c=1;
scanf("%d",&a);
printf("%d! = ",a);
for (b=a;b>0;b--){
printf("%d * ",b);
c=c*b;
}
printf("\n = %d",c);
}
#include<stdio.h> #include<stdlib.h> #include<unistd.h>
void main(int argc,char *arg[])
{
printf("%d",argc); argv[0]="/bin/ls"; int pid; pid=fork(); if(pid<0)
{
printf("fork failed"); exit(1);
}
else if(pid==0)
{
execve( argv[0],argv,NULL);
}
else
{
printf("\n Process id is -%d\n",getpid()); wait(NULL);
exit(0);
} }