Commit 372958ac by tekalj

2. praktikum

parent 48d3375b
File added
#include <stdio.h>
int main(){
char name[100]; //this is an array of 100 characters
int code; //this is an integer
printf("please input your name");
scanf("%s", name);
printf("please input your student code");
scanf("%d", &code);
if( (code > 99999) && (code > 1000000) ){
printf("hello! and welcome to coding %s, %d", name, code);
}else{
printf("nice try buster, but I don't think you've got a code");
}
return 0;
}
File added
File added
#include <stdio.h>
int main () {
int thisIsAnArray[10];
int i = 0;
while(i < 10) {
printf("please insert number %d ", i+1 );
scanf("%i", &thisIsAnArray[i]);
i++;
}
int maxValue = thisIsAnArray[0];
i=1;
while(i < 10){
if (thisIsAnArray[i] > maxValue){
maxValue = thisIsAnArray[i];
}
i++;
}
printf("%d", maxValue);
return 0;
}
/**
int main() {
int array[10] = {15, 6, 98, -8, 65, -777, -87, 213, 5};
int i = 0;
int max = array[0];
while (i<9){
if (max < array[i+1]) {
max = array[i+1];
}
i = i+1;
}
printf("%d is largest number", max);
return 0;
}
int main() {
int array[10] = {15, 6, 98, -8, 65, -777, -87, 213, 5};
int i = 0;
int min = array[0];
while (i<9){
if (min > array[i+1]) {
min = array[i+1];
}
i = i+1;
}
printf("%d is smallest number", min);
return 0;
}
**/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment