A,B=map(str,input().split()) # let's begin by casting strings to strings!
while(int(A)!=0 and int(B)!=0):
tamanhoa=0
tamanhob=0
for i in range(len(A)):
tamanhoa+=1 # wonderful way to determine the length of
# a string!
for i in range(len(B)):
tamanhob+=1
vA = [0]*tamanhoa
vB = [0]*tamanhob
if tamanhoa>tamanhob:
vA = [0]*tamanhoa # Just to make sure it really gets set!!!
vB = [0]*tamanhoa
for i in range(tamanhoa-1,-1,-1):
vA[i]=int(A[i]) # he even saved an operation by casting
# the char to int at the same time!
for i in range(tamanhob):
vB[i+1]=int(B[i])
elif tamanhoa<tamanhob:
vA = [0]*tamanhob # Just to make sure it really gets set!!!
vB = [0]*tamanhob
for i in range(tamanhoa):
vA[i+1]=int(A[i])
for i in range(tamanhob-1,-1,-1):
vB[i]=int(B[i])
tamanhoa=tamanhob
else:
for i in range(tamanhoa):
vA[i]=int(A[i])
for i in range(tamanhob):
vB[i]=int(B[i])
print(vA)
print(vB)
carry = 0
for i in range(tamanhoa-1,-1,-1):
soma = vA[i] + vB[i]
if soma > 9:
carry += 1
if vA[i-1]!= 9:
vA[i-1] += 1
else:
vB[i-1] +=1
if carry == 0:
print('No carry operation.')
elif carry == 1:
print(carry, 'carry operation.')
else:
print(carry, 'carry operations.')
A,B=map(str,input().split()) # why bother casting strings to int? yay
if int(A)==0 and int(B)==0:
break
This wonder was found within answers to a university programming test. Code as-is, comments added by me.
int min(int a,int b,int c) //Function to return the minimum.
{
if(a < b)
{
if(a < c)return a;
else if(a > c)return c;
else return a;
}
else if(a > b)
{
if(b < c)return b;
else if(b > c)return c;
else return b;
}
else
{
if(a < c) return a;
else if(a > c) return c;
else return a;
}
}
This kind of things make me hate my work.
int minimum(int a, int b, int c){
int mini =a*b*c;
int iterator=0;
int test[3];
test[0]=a;
test[1]=b;
test[2]=c;
for (iterator=0;iterator<3;iterator++){
if (test[iterator]<mini){
mini=test[iterator];
}
}
return mini;
}
I hope that your 3 numbers aren't larger than 1290!
<?php
if ($_GET['csrfstopper'] !== 1){
exit();
}
Please don't judge my friend trying to stop CSRF Attacks he's still learning.
file = fopen(argv[1], "r");
if (file == NULL){}
exit(EXIT_FAILURE);
Those silly curly braces.
$number = int(1);
<?php
if(isset($_POST['csrf'])){
if($_POST['csrf'] !== $_SESSION['csrf']){
return 'session expired!';
}
}
In all Sama Samaneh
university and class management system from iran :)
private <T> Supplier<T> abort(Class<T> exception) {
return () -> {
try {
return exception.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
throw new RuntimeException(e);
}
};
}
...
throw abort(MyException.class).get();
// STEP 5: IF WE ARE TERRAN, THIS MATTERS, SO: LOL
void BuildingManager::checkForDeadTerranBuilders() {}
precision mediump float;
uniform float time;
uniform vec2 resolution;
#define equals =
#define divided /
#define plus +
#define minus -
#define times *
#define by
#define point .
#define zero 0.
#define one 1.
#define five 5.
#define output gl_FragColor
#define then {
#define end }
#define less <
#define than
#define increment ++
#define afterwards ;
#define comma ,
#define semi .5
#define hundred 100.
void main ( void ) then
vec2 uv equals gl_FragCoord point xy divided by resolution point xy afterwards
float number equals sin( time plus uv point y ) afterwards
for ( float i equals zero afterwards i less than five afterwards increment i) then
number equals mod ( uv point x comma number ) afterwards
end
output equals vec4 (uv point x comma uv point y comma number times hundred comma one ) afterwards
end
if( %rightBtnCmd $= "noButtons" )
{
//do nothing, as there are no buttons
}
proprietary script language.
function changePassword() {
if (isInputEmpty()) {
$.ajax({
type: 'POST',
data: '...'
url: '...',
success: function (result) {
if (result.substring(0, 3) != "!!!") {
//success
} else {
//faliure
}
},
error: function () {
}
});
}
}
And of course,in production, it always reported success and never changed the password, because of equally bad server code.
function getJSType(cppType: string) {
let typeMap = new Map<string, string>([
["Bool", "boolean"],
["Int32", "number"],
["UInt32", "number"],
["Int64", "number"],
["UInt64", "number"],
["Double", "number"],
["String", "string"],
["Object", "any"]
]);
if (typeMap.get(cppType) === undefined) {
console.error("Invalid type in getJavascriptType: " + cppType);
process.exit(1);
}
return typeMap.get(cppType);
}
public static int[] xxx(String filename) throws IOException{
int[] f = new int[26];
BufferedReader in = new BufferedReader(new FileReader(filename));
String line;
while((line = in.readLine()) != null){
line = line.toUpperCase();
for(char ch:line.toCharArray()){
if(Character.isLetter(ch)){
f[ch - 'A']++;
}
}
}
in.close();
return f;
}
int true = 0;
while (true)
{
//do something
}
true = false