Docsity

Computer Programming in c with examples, Exercises of Computer Programming

Partial preview of the text

Download Computer Programming in c with examples and more Exercises Computer Programming in PDF only on Docsity!

INF101 - PROBLEMSET 1

Aufgabe 1: 1

a)100001=1+64=65 A 1

1001100=L

b)ALO

Aufgabe 2:

a) 69:2=34:2=17:2=8:2=4:2=2:2=1: 1 0 1 0 0 0 1 1000101 6 Bits b) 4 = 000100

  • 4= 111011 c) 4 = 000100 111011
  • 000001 111100
  • 4=

4+8+64=76 L

1+2+8+64=75 K

OK

OK

OK

OK

d) 161. 161:2=80:2=40:2=20:2=10:2=5:2=2:2=1: 1 0 0 0 0 1 0 1 161 = 10100001 0,452=0,9 0 0,92=1,8 1 0,82=1,6 1 0,62=1,2 1 0,22=0,4 0 0,42=0,8 0 0,8*2=1,6 1 … 0,45= 161,45=10100001,011100… =1,0100001011100... * 2^7

e) 1 | 10000110 | 0100001011100110011001

Vorzeichnen :Positive e‘=e + =7+127=134(128+4+2) Nachkomma Vorzeichnen :Negative

Aufgabe 4:

Aufgabe 5:

Aufgabe 5:

#include <stdio.h> int zahlTeilbarDurch(int a,int b) { int rest = a % b; if( rest == 0 ) { return 1; } return 0; return rest; } int main() { int x; x = zahlTeilbarDurch(21,3); if( x == 1 ) { printf("1\n"); } else { printf("0\n"); } return 0; }