This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Datatypes | Range | Bytes | Format | |
signed char | -128 to +127 | 1 | %c | |
unsigned char | 0to 255 | 1 | %c | |
short signed int | -32768 to +32767 | 2 | %d | |
short unsigned int | 0 to 65535 | 2 | %u | |
signed int | -32768 to +32767 | 2 | %d | |
unsigned int | 0 to 65535 | 2 | %u | |
long signed int | -2147483648 to +2147483647 | 4 | %ld | |
long unsigned int | 0 to 4294967295 | 4 | %lu | |
float | -3.4eˆ38 to +3.4eˆ38 | 4 | %f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Author: Pratik Sah | |
Topic: Using If statement | |
*/ | |
main(){ | |
if (condition) { //'{ }' for multiple statements | |
statement 1; | |
statement 2; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
A simple program to find a negative number | |
Author: Pratik Sah | |
*/ | |
main(){ | |
int n; | |
printf("Enter any number: "); | |
scanf("%d", &n); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Author: Pratik Sah | |
Date: 30-03-17 | |
*/ | |
main(){ | |
int n; | |
printf("Enter any number:"); | |
scanf("%d",&n); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Author: Pratik Sah | |
Date: 01-04-17 | |
*/ | |
main(){ | |
int n; | |
printf("Enter any number:"); | |
scanf("%d", &n); | |
if (n%2==0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Author: Pratik Sah | |
Topic: Syntax of nested if else statement | |
*/ | |
main(){ | |
if (condition) { | |
statement 1; | |
statement 2; | |
} | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Author: Pratik Sah | |
Date: 01-04-17 | |
*/ | |
main(){ | |
int n; | |
printf("Enter any number:"); | |
scanf("%d", &n); | |
if (n<0) | |
printf("-ve number."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Author: Pratik Sah | |
Date: 01-04-17 | |
*/ | |
main(){ | |
int a,b,c; | |
printf("Enter any three numbers:\n"); | |
scanf("%d%d%d", &a,&b,&c); | |
if (a>b && a>c) | |
printf("%d is greatest.", a); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Author: Pratik Sah | |
Topic: Syntax of if else statement | |
*/ | |
main(){ | |
if (condition) { | |
statement 1; | |
statement 2; | |
} | |
else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch (expression) { | |
case 1: //block 1 statement; | |
break; | |
case 2: //block 2 statement; | |
break; | |
.... | |
.... | |
default: //default statement; | |
} |