# Practice questions on Let's start

## Level 1

1.
Point out the errors in the following codes:

```#include <stdio.h>
int main(){
printf(Hello);
return 0;
}
```

```#include <stdio.h>
int main(){
printf("Hello");
return 0;
}
```

2.
Point out the errors in the following codes:

```#include <stdio.h>
/*Using comment
/*This is a comment*/
*/
int main(){
printf("Hello\n");
return 0;
}
```

Comment inside comment is invalid

3.
Point out the errors in the following codes:

```#include <stdio.h>
int main(){
printf("Hello")
return 0
}
```

```#include <stdio.h>
int main(){
printf("Hello");
return 0;
}
```
Missing ;

4.
Point out the errors in the following codes:

```int main(){
printf(Hello);
return 0;
}
```

```#include <stdio.h>
int main(){
printf("Hello");
return 0;
}
```
stdio.h not included

## Level 2

1.
Write a C program to print
*
**
***
****
on screen.
```#include <stdio.h>
main() {
printf("*\n");
printf("**\n");
printf("***\n");
printf("****\n");
}
```

2.
Store two integers in two variables x and y. Print the sum of the two.
```#include <stdio.h>
main() {
int x, y, sum;  //declaration of integer variables
x = 3;
y = 5;
sum = x + y;
printf("%d\n", sum);
}
```

3.
Store two integers in two variables x and y. Print the product of the two.
```#include <stdio.h>
main() {
int x, y, product;  //declaration of integer variables
x = 3;
y = 5;
product = x * y;
printf("%d\n", product);
}
```

4.
Print the following pattern on the screen
****
**
*
**
****

5.
Write a C program to take two integer inputs from user and print the sum and the product of them.
```#include <stdio.h>
main() {
int x, y, sum, product;
scanf("%d", &x);                 //taking input for value of x
scanf("%d", &y);                 //taking input for value of y
sum = x + y;
product = x * y;
printf("sum = %d\n", sum);
printf("product = %d\n", product);
}
```

6.
Take two integer inputs from the user. First calculate the sum of two then product of two. Finally, print the sum and the product of both obtained results.
```#include <stdio.h>
main() {
int x, y, sum, product;
scanf("%d", &x);                 //taking input for value of x
scanf("%d", &y);                 //taking input for value of y
sum = (x + y) + (x * y);
product = (x + y) * (x * y);
printf("sum = %d\n", sum);
printf("product = %d\n", product);
}

```