Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions C++/Program-7/program.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <iostream>
using namespace std;

int main()
{
int rows, n = 1;

cout << "Enter number of rows: \n";
cin >> rows;

for(int i = 0; i < rows; i++)
{
for(int line = 1; line <= rows-i; line++)
cout <<" ";

for(int j = 0; j <= i; j++)
{
if (j == 0 || i == 0)
n = 1;
else
n = n*(i-j+1)/j;

cout << n << " ";
}
cout << endl;
}

return 0;
}
1 change: 1 addition & 0 deletions C++/Program-7/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C++ Program to print Pascal' triangle
77 changes: 56 additions & 21 deletions C/program-61/program.c
Original file line number Diff line number Diff line change
@@ -1,23 +1,58 @@
#include<stdio.h>
void main()
/*
This Program calulates all the prime between the range of numbers
includes the numbers which is provided.

For e.g: 2 7
Prime Numbers are : 2 3 5 7
*/

#include <stdio.h>
#include <stdlib.h>

char primecheck(int);

int main()
{
double r,area,circum;//Initializing varaibles

printf("Enter Radius:");
scanf("%lf",&r);//getting radius.

if(r<10)//Checks if radius is less than 10
{
circum = 2*3.14*r;//Circumference of a circle is 2*pi*r.

printf("The Circumference of the Circle with the given radius is: %lf",circum);//printing Circumference
}
else//If r is NOT less that 10....i.e. r is greater than 10
{
area = 3.14*r*r;//Area of a circle is pi*r*r.

printf("The Area of the Circle with the given radius is: %lf",area);//printing The area
}
getch();

int i,num1,num2,cases;
char ans;
printf("Enter Number of Test Cases: ");
scanf("%d",&cases);
while (cases--)
{
printf("Enter First Number: ");
scanf("%d",&num1);
printf("Enter Second Number: ");
scanf("%d",&num2);

printf("Answer: ");
for(i=num1;i<=num2;i++)
{
ans = primecheck(i);
if (ans == 'y')
printf("%d ",i);
}
printf("\n");
}
return 0;
}

char primecheck(int num)
{
int i;
if (num == 0 || num == 1)
return 'n';
else
{
for(i=(num-1);i>1;i--)
{
if(num%i == 0)
{
return 'n';
}
else
continue;
}
return 'y';
}

}
3 changes: 2 additions & 1 deletion Python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
| Program-14 | Program to find simple interest for given principal amount, time and rate of interest. |
| Program-15 | Program to sort the array and give the time to sort the array. |
| Program-16 | Program to print a right angled triangle. |
| Program-17 | Program to check leap year or not. |
| Program-17 | Program to convert Binary to Decimal. |
| Program-18 | Program to check leap year or not. |



Expand Down
24 changes: 14 additions & 10 deletions Python/program-17/program.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
for i in range(1,6):
for j in range(1,6-i):
print(" ",end=" ")
for k in range(1,i+1):
print(k,end=" ")
if i>1:
for l in range(1,i+1):
print(l,end=" ")
print()

#Python Program to Convert Decimal to Binary

def decimalToBinary(num):
"""This function converts decimal number
to binary and prints it"""
if num > 1:
decimalToBinary(num // 2)
print(num % 2, end='')


# decimal number
number = int(input("Enter any decimal number: "))

decimalToBinary(number)
7 changes: 0 additions & 7 deletions Python/program-17/readme.md

This file was deleted.

11 changes: 7 additions & 4 deletions Python/program-18/program.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
for i in range(1,6):
for j in range(1,i+1):
print(i,end=' ')
print()

year = int( input('Enter Year: '))

if (year%4) and (year%100) and (year%400) == 0:
print('Leap year')
else:
print('Not leap year')
6 changes: 0 additions & 6 deletions Python/program-18/readme.md

This file was deleted.

14 changes: 0 additions & 14 deletions Python/program-19/program.py

This file was deleted.

1 change: 0 additions & 1 deletion Python/program-19/readme.md

This file was deleted.

7 changes: 0 additions & 7 deletions Python/program-20/program.py

This file was deleted.