xxxxxxxxxx
#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;
}
xxxxxxxxxx
from __future__ import division
import os
import sys
import glob
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
%matplotlib inline
%precision 4
plt.style.use('ggplot')
xxxxxxxxxx
#Importting csv module
import csv
#csv file name
filename= "aapi.csv"
# intiliaze titles and rows
fields =0
rows = 0
# reading csv file
with open(filename,'r') as csvfile:
# extract each data row one by one
csvreader=csv.reader(csvfile)
rows.append(rows)
# get total no of rwos
print("Total no of rows:%d%(csvreader.line_num)")
# print fields name
print('Field names are:' + ', '.join(field for field in fields))
# print first 5 rows
print('\n First 5 rows are:\n')
for row in rows[:5]:
# parsing each column of rows
for col in row:
print("%10s"%col),
print('\n')
xxxxxxxxxx
let eval_var variable liste =
let rec aux = function
| [] -> false
| h::t -> variable = h || aux t
in
aux liste;;
xxxxxxxxxx
#include<stdio.h>
int main()
{
double b1,h1,b2,h2,a1,a2;
scanf("%lf %lf %lf %lf",&b1,&h1,&b2,&h2);
a1=(b1*h1)/2;
a2=(b2*h2)/2;
if(a1>a2)
printf("%0.2lf",a1);
else
printf("%0.2lf",a2);
}
xxxxxxxxxx
#include<stdio.h>
int main()
{
double b1,h1,b2,h2,a1,a2;
scanf("%lf %lf %lf %lf",&b1,&h1,&b2,&h2);
a1=(b1*h1)/2;
a2=(b2*h2)/2;
if(a1>a2)
printf("%0.2lf",a1);
else
printf("%0.2lf",a2);
}
xxxxxxxxxx
#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;
}
xxxxxxxxxx
#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",¤t);
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;
}
xxxxxxxxxx
#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",¤t);
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;
}