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
/*malloc example | |
* random string generator | |
* malloc, free, random | |
*/ | |
#include <iostream> | |
using namespace std; | |
int main() { |
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
#include <stdio.h> | |
#include <malloc.h> | |
int main() { | |
int i, n, sum = 0; | |
int *ptr; | |
printf("enter the size of the array: "); |
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
/* | |
* C program to find the sum of two one-dimensional arrays using | |
* Dynamic Memory Allocation | |
*/ | |
#include <iostream> | |
using namespace std; | |
int main() { |
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
/* | |
* C Program to Check whether a given String is Palindrome or not | |
* using Recursion | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
void check(char[], int); |
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
/* | |
contcat to string. | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
int main() { | |
char string1[20], | |
string2[20]; | |
int i, j; |
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
numbers = [12,4,45,3,6] | |
even = [] | |
odd = [] | |
while(len(number) > 0) : | |
number = numbers.pop() | |
if(number % 2 == 0 ) : | |
even.append(number) | |
else: | |
odd.append(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
print "What's your first name?" | |
first_name = gets.chomp | |
first_name.capitalize! | |
print "What's your last name?" | |
last_name = gets.chomp | |
last_name.capitalize! | |
print "What city are you from?" | |
city = gets.chomp |
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
=begin | |
Simple Grade exercise | |
=end | |
print "Enter your marks: " | |
grade = Integer(gets.chomp) | |
case grade | |
when 90..100 | |
letter_grade = "A" |