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
#/usr/bin/python3 | |
print("Press 'Ctrl+C' to exit this tool.") | |
try: | |
while True: | |
print("\nPlease input price in BDT: ") | |
a = raw_input() | |
try: | |
float(a) | |
except ValueError: |
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
print("This program takes a nested array of integer numbers and returns a flat array") | |
print("Press Ctrl+C to exit") | |
try: | |
while True: | |
flat_array = [] | |
nested_array = input("Pleas input your arbitrary array:\n") | |
def loop_through_list(given_list): # this function checks if list items are a list themselves | |
for a in given_list: # and if so, it calls itself within that list item. | |
if type(a) == list: |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Arrays</title> | |
<style> | |
body { | |
font-family: monospace; | |
margin: 50px; | |
} |
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> | |
//a program that checks if a number is Even or Odd | |
int main() { | |
int number; | |
printf("Enter your number:\n"); | |
scanf("%d", &number); | |
if (number % 2 == 0) { | |
printf("The number is Even"); | |
} else { | |
printf("The number is Odd"); |
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> | |
//a program that checks if a number is positive or negative or nutral | |
int main() { | |
int number; | |
printf("Enter your number:\n"); | |
scanf("%d", &number); | |
if (number > 0) { | |
printf("The number is positive"); | |
} else if (number < 0){ | |
printf("The number is negative"); |
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 mark; | |
printf("Enter your mark:\n"); | |
scanf("%d", &mark); | |
if (mark <= 100){ //dive in only if mark is less than 100. mark can be negative too | |
if (mark >= 79) { | |
printf("Your grade is A+\n"); | |
} else if (mark >= 69) { |
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 number; | |
printf("Enter your number:\n"); | |
scanf("%d", &number); | |
if (number > 3){ // 1,2,3 are prime for sure; verification starts for bigger numbers; | |
for (int i = 2; i<number; i++){ | |
if (number % i == 0){ | |
printf("The number is not a prime number.\n"); |
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 range, total_prime_in_range = 0; | |
printf("Enter your range:\n"); | |
scanf("%d", &range); | |
printf("The prime numbers in that range are:\n"); | |
for (int i=1; i<=range; i++){//loops through the input numbers | |
int not_prime = 0; | |
for (int j=2; j<i/2; j++){ |
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 rows, i, j, k, spaces, stars; | |
printf("Enter rows for your pyramid:\n"); | |
scanf("%d", &rows); | |
spaces = rows -1; | |
stars = 1; | |
if (rows % 2 > 0 && rows < 30){ | |
printf("Your pyramid should look like this:\n"); |
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 data[11] = {10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60}; | |
int entry, i, position=1; | |
printf("Here is the array:\n"); | |
for (i=0; i<11; i++){ | |
printf("%d\t", data[i]); | |
} | |
printf("\n"); |
OlderNewer