-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTask-4.txt
47 lines (47 loc) · 1.18 KB
/
Task-4.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
task-4
Create a readme file using MARKDOWN LANGUAGE
Here are some of programs in C-language
1.HELLO WORLD
#include <stdio.h>
int main()
{
printf("Hello, World!");
return 0;
}
2.ADD TWO INTEGERS
#include <stdio.h>
int main()
{
int number1, number2, sum;
printf("Enter two integers: ")
scanf("%d %d", &number1, &number2);
sum = number1 + number2;
printf("%d + %d = %d", number1, number2, sum);
return 0;
}
3.Find the ASCII value of a character
#include <stdio.h>
int main()
{
char c;
printf("Enter a character: ");
scanf("%c", &c);
// %d displays the integer value of a character
// %c displays the actual character
printf("ASCII value of %c = %d", c, c);
return 0;
}
4.Check ODD or EVEN.
#include <stdio.h>
int main()
{
int num;
printf("Enter an integer: ");
scanf("%d", &num);
// True if num is perfectly divisible by 2
if(num % 2 == 0)
printf("%d is even.", num);
else
printf("%d is odd.", num);
return 0;
}