This file contains 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
# text1.txt content | |
''' | |
hello easter science | |
how are you | |
we assist you to choose the best | |
''' | |
with open('test1.txt', 'r') as r_file: | |
x = r_file.readlines() | |
res = [] |
This file contains 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
''' | |
You are invited to participate in an encryption algorithm competition. Encryption is a method to change the formation of the message using pre-defined rules. After encryption, the message becomes secure and illegible. | |
Develop a program that takes user input as a string sentence and prints its encryption version using the following rules: | |
1. You must include your ID, name and section number as sample input. | |
2. The program should also include your ID as a prefix to all input sentences. | |
3. Each word should be encrypted separately. | |
4. If a word starts with consonant letter, then that word should be shifted two places in circular way. For example, “trend” become “ndtre”, “brown” become “wnbro”, etc. | |
5. Also, aftershifting, do append “ay” at the end of the word. So, a word “trend” become “ndtreay”. | |
6. If a word starts with a vowel letter, then it should be encrypted by simply appending "way". For example, “end” becomes “endway”. | |
7. The letter 'y' is a treated as a consonant if it appears as the |
This file contains 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
#include<stdio.h> | |
int main(){ | |
int i=0; | |
//method 1: declaration of array | |
//int marks[5]; | |
//method 2: declaration with initialization of array | |
int marks[5] = {80, 60, 70, 85, 75}; | |
This file contains 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
# include<stdio.h> | |
void abc(); | |
void xyz(); | |
# pragma startup abc | |
# pragma exit xyz | |
void main() | |
{ | |
printf("\n Main Function."); | |
} |
This file contains 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
# include<stdio.h> | |
# define BOY | |
# undef BOY | |
void main(){ | |
#ifdef BOY | |
printf("This is a boy."); | |
#endif // BOY |
This file contains 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
#include<stdio.h> | |
# define TEST 5 | |
int main(){ | |
# if TEST < 5 | |
printf("TEST is smaller than 5."); | |
# elif TEST == 5 | |
printf("TEST is equal to 5."); | |
# else | |
printf("TEST is greater than 5."); |
This file contains 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
#include<stdio.h> | |
# define BOY | |
int main() | |
{ | |
//Conditional Compilation | |
# ifdef BOY | |
printf("He is a boy."); | |
# else | |
printf("She is a girl."); |
This file contains 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
#include<stdio.h> | |
#include "circle.c" | |
#include "circle.h" | |
int main() | |
{ | |
float r = 4.0; | |
printf("%.2f", circle_area(r, PI)); | |
return 0; | |
} |
This file contains 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
//Static Storage Class Variable | |
//Speed Test | |
#include<stdio.h> | |
#include<time.h> | |
int main() | |
{ | |
static int i; | |
for(i=1;i<=100000000;i++); |
This file contains 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
//External Storage Class Variable | |
//Speed Test | |
#include<stdio.h> | |
#include<time.h> | |
int i; | |
int main() | |
{ | |
for(i=1;i<=100000000;i++); | |
int ticks=clock(); |
NewerOlder