KI001.c
Metadata
- Author — Amit Dutta (amitdutta4255@gmail.com)
- Last updated — 12 Dec 2025
- License — MIT
Source Code
Printing the code
To print this file, open it on GitHub and click Raw before printing, or use the Download Raw button above and print directly from that page.
c
#include <stdio.h>
int main()
{
// testing number
int num, len = -13 /* here minus 13 because we will remove the massage characters in line 10 */;
printf("Enter a number to get the length : ");
scanf("%d", &num);
len += printf("Your input : %d", num); // here the "Your input : ", this 13 characters are extra
printf("\nLength : %d", len);
// testing char
char a[20];
len = -13;
while (getchar() != '\n')
;
printf("\nEnter a word to get the length : ");
scanf("%19s", &a);
len += printf("Your input : %s", a); // here the "Your input : ", this 13 characters are extra
printf("\nLength : %d", len);
return 0;
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21