Skip to content
Open
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
21 changes: 21 additions & 0 deletions Recursion
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <iostream>
using namespace std;
//Factorial function
int f(int n){
/* This is called the base condition, it is
* very important to specify the base condition
* in recursion, otherwise your program will throw
* stack overflow error.
*/
if (n <= 1)
return 1;
else
return n*f(n-1);
}
int main(){
int num;
cout<<"Enter a number: ";
cin>>num;
cout<<"Factorial of entered number: "<<f(num);
return 0;
}
37 changes: 37 additions & 0 deletions TCS_Digital pipequestion.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include<iostream>
using namespace std;
int main()
{
int N,M,R, incoming[1000],outgoing[1000],actin[1000],acout[1000];
int totin, totout;

cin>>N>>M>>R;

for(int i=0; i<N; i++)
{
cin>>incoming[i];
actin[i]= incoming[i]-R;

for(int i=0; i<M; i++)
{
cin>>outgoing[i];
acout[i]= outgoing[i]-R;
}
totin = 0;
totout=0;
for (int i=0;i<N;i++){
totin += actin[i];
}
for (int i=0;i<M;i++){
totout += acout[i];
}
int addpipe;
addpipe =(totin-totout)+R;
if (totin == totout){
cout<<"BALANCED";
}
else{
cout<<addpipe;
}
return 0;
}
19 changes: 19 additions & 0 deletions Text_to_speech.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#first install gtts package on cmd --> pip install gtts
from gtts import gTTS
#import gTTS from package install
import os #neeed to learn more ...
#inbuild package

#mytext= "Text to speech conversion using python" #we can gave text here too or
#to read the file make file handler
#default method in python which is used to open file open(,"r") and read(mode),it can be write too
fh=open("text.txt","r")
mytext=fh.read().replace("\n"," ") #here i too replace all the line ending with " "

language="en"#variable called language t lang we us fr-->french,en-->english which is supported by gTTS

output=gTTS(text=mytext,lang=language,slow=False) #slow makes False so our audio play in fast speed not in slow speed

output.save("output.mp3") #u can saved ur output in mp3 by calling method call save
fh.close()
os.system("start output.mp3") #for playing audio file