1#include <stdio.h>
2int main()
3{
4 char chr;
5 printf("Enter a character: ");
6 scanf("%c",&chr);
7 printf("You entered %c.", chr);
8 return 0;
9}
1#include <stdio.h>
2int main()
3{
4 int testInteger;
5 printf("Enter an integer: ");
6 scanf("%d", &testInteger);
7 printf("Number = %d",testInteger);
8 return 0;
9}
1#include <stdio.h>
2//this is for storing numbers
3int main(){
4
5 int age; //this makes a vairable for you to store the value in
6 printf("enter in your age: "); //this prints a prompt for the user
7 scanf("%d", &age); //this takes in the argument given and stores it
8 //into the address of age
9
10 return 0;
11}
1Integer: Input: scanf("%d", &intVariable); Output: printf("%d", intVariable);
2Float: Input: scanf("%f", &floatVariable); Output: printf("%f", floatVariable);
3Character: Input: scanf("%c", &charVariable); Output: printf("%c", charVariable);
1#include <stdio.h>
2//this is for entering and storing strings
3int main(){
4 char name[20];
5
6 printf("Enter a name : ");
7 scanf("%s", &name);
8
9 printf("the name entered is: %s\n", name);
10
11
12
13return 0;
14}