“Konversi C ke Phyton” Kode Jawaban

Konversi C ke Phyton

#include <stdio.h>
#include <string.h>

int mylen(char *n);

int mylen(char *n)
{
  int count=0;
  for(int i=0; n[i]!='\0'; i++){
    count++;
  }
  printf("count=%d",count);
  return count;
}

int main(void){
  char name[20];
  
  printf("enter name:\n");
  scanf("%s",&name);
  puts(name);
  int len = mylen(name);
  printf("length = %d",len);
  return 0;
}
Odd Owl

Konversi C ke Phyton

#include<stdio.h>
int main(){
  signed int current, birth, a;
  printf("Enter Year of Birth\n");
  scanf("%d",&birth);
  printf("Enter Current year\n");
  scanf("%d",&current);  
  if(current<birth)
  {
    birth=100-birth;
    a=birth+current;
    printf("Your age is %d",a);
  }
  else
  {
  printf("Your age is %d",current-birth);
  }
  return 0;
}
5072_ NIVASH B

Konversi C ke Phyton

#include<stdio.h>
int main()
{
    int i,j;
    char s1[100],s2[100],s3[100];
    scanf("%s %s", s1,s2);
    for(i=0,j=0;s2[i]!='\0';i++,j++)
    {
        s3[j]=s2[i];
    }
    for(i=0;s2[i]!='\0';i++,j++)
    {
        s3[j]=s2[i];
    }
    s3[j]='\0';
    j=0;
    for(i=0;s3[i]!='\0';i++)
    {
        if(s3[i]==s1[j])
        {
            j++;
        }
        else
            j=0;
        if(s1[j]=='\0')
        {
            printf("1");
            break;
        }
    }
    if(s1[j]!='\0')
    {
        printf("-1");
    }
    return 0;
}
Muddy Manatee

Konversi C ke Phyton

#include<stdio.h>
int main(){
  signed int current, birth, a;
  printf("Enter Year of Birth\n");
  scanf("%d",&birth);
  printf("Enter Current year\n");
  scanf("%d",&current);  
  if(current<birth)
  {
    birth=100-birth;
    a=birth+current;
    printf("Your age is %d",a);
  }
  else
  {
  printf("Your age is %d",current-birth);
  }
  return 0;
}
5072_ NIVASH B

Jawaban yang mirip dengan “Konversi C ke Phyton”

Pertanyaan yang mirip dengan “Konversi C ke Phyton”

Lebih banyak jawaban terkait untuk “Konversi C ke Phyton” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya