BUCKET ID
C
C
#include<stdio.h>
int main()
{
long int n;
scanf(“%ld”,&n);
int m;
m=n%10;
while(n)
{
if(m>n%10)
m=n%10;
n=n/10;
}
printf(“%d”,m);
return 0;
}
ODD EVEN ONLINE GAME
C
C
#include<stdio.h>
int main()
{
int n;
scanf(“%d”, &n);
int i,a[n];
for(i=0;i<n;i++)
{
scanf(“%d”,&a[i]);
}
for(i=0;i<n;i++)
{
if(a[i]%2==0)
printf(“%d “,a[i]);
}
for(i=0;i<n;i++)
{
if(a[i]%2!=0)
printf(“%d “,a[i]);
}
}
SPECIAL CHARACTERS
C
C
#include <iostream>
using namespace std;
int main(){
string s;
getline(cin,s);
int count = 0;
for(int i = 0; s[i]!=’\0′; i++){
if(s[i] >= 65 && s[i]<=90)
continue;
if(s[i] >=97 && s[i]<=122)
continue;
if(s[i] >=48 && s[i]<=57)
continue;
count++;
}
cout<<count<<endl;
return 0;
}
OIL FACTORY
Python
Python
a = int(input())
b = int(input())
l1 = []
for i in range(a, b+1):
count = 0
if i < 0:
for j in range(i, 0):
if i % j == 0:
count += 1
if count == 2:
l1.append(i)
break
if i > 0:
for j in range(1, i+1):
if i % j == 0:
count+=1
if count == 2:
l1.append(i)
break
for i in range(b, a-1,-1):
count = 0
if i < 0:
for j in range(i, 0):
if i % j == 0:
count += 1
if count == 2:
l1.append(i)
break
if i > 0:
for j in range(1, i+1):
if i % j == 0:
count+=1
if count == 2:
l1.append(i)
break
if sum(l1) < 0:
print(-(sum(l1)))
else:
print(sum(l1))
Length of Last Word
Python
Python