“Convertir C à Phyton” Réponses codées

Convertir C à 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

Convertir C à 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

Convertir C à 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

Convertir C à 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

Réponses similaires à “Convertir C à Phyton”

Questions similaires à “Convertir C à Phyton”

Plus de réponses similaires à “Convertir C à Phyton” dans Python

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code