Commit 4a8381f4 by otsall

sync

parent 0790ec7b
#include <stdio.h>
int main(){
char name[100]; //this iś an array of 100 characters
int code; // this is an integer
printf("insert your name\n");
scanf("%s", name); // s - array of characters, string
printf("insert your student code\n");
scanf("%d", &code); // d- digit, interchangeable with i - integer
// anything that isnt a string needs an &
if ( (code > 99999) && (code <1000000)) {
printf("hello! and welcome to coding %s, %d", name, code);
}else{
printf("error, deleting System32");
}
return 0;
}
File added
#include <stdio.h>
int main(){
int array[10];
int i = 0;
while(i<10) {
scanf("%d", &array[i]);
i++;
}
int sum=0;
i=0;
while(i<10) {
sum=sum+array[i];
i++;
}
float avg=sum/10.;
printf("the average sum is %f",avg);
return 0;
}
File added
#include <stdio.h>
int main (){
int arrayof10[10];
int i = 0;
while(i<10){
scanf("%i", &arrayof10[i]);
i=i+1;
}
int MaxValue = arrayof10 [0];
i=1;
while(i<10){
if (arrayof10[i] > MaxValue){
MaxValue = arrayof10[i];
i++;
}else{
i=i+1;
}}
printf("the maximum value is %i",MaxValue);
return 0;
}
#include <stdio.h>
int main () {
int score = 20;
int passingScore =35;
if (score<passingScore) {
printf("you didn't pass lol");
} else if(score == passingScore) {
printf("beg the prof for mercy");
}else{
printf("pass! go home");
}
return 0;
}
File added
#include <stdio.h>
int main () {
int i=0;
int x =2;
while (i<10){
x+=1;
printf("%d\n", x);
i+=1;
}
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