C & C++ PROGRAMMING
3.18K subscribers
126 photos
6 videos
65 files
76 links
https://t.me/addlist/oJIs6WVKrqBmMWQ1

Hello! I am @Myhurthearts and welcome to the Coding channel! Here we can learn all things related to coding and improve our skills , just let me know!
Download Telegram
πŸ‘2
Program to swap values of two variables.
#include <iostream>

int main() {
int a=1;
int b=2;
int temp;
std::cout << "Before Swapping:\n";
std::cout << "a=" << a <<",b=" << b <<"\n";
temp = a;
a=b;
b=temp;
std::cout << "After Swapping:\n";
std::cout << "a=" << a <<",b=" << b <<"\n";
return 0;
}
πŸ‘5❀1
C & C++ PROGRAMMING
https://youtu.be/TBQrLkcK1KQ?si=9fGmOTMDKDx8w8Ht
πŸ‘†100% Ai ka use krk Music Rap Video bnaya 😁

Plz watch guys and give some response about video 😁
Program to swap values of two variables.
#include <iostream>

int main() {
int a=1;
int b=2;
int temp;
std::cout << "Before Swapping:\n";
std::cout << "a=" << a <<",b=" << b <<"\n";
temp = a;
a=b;
b=temp;
std::cout << "After Swapping:\n";
std::cout << "a=" << a <<",b=" << b <<"\n";
return 0;
}
Program to convert temperature from Fahrenheit to Celsius.
#include <iostream>
using namespace std;
int main() {
double fahrenheitTemperature;
double temperatureInCelsius;
cout << "Enter your temperature in Fahrenheit:";
cin >> fahrenheitTemperature;
temperatureInCelsius = ((fahrenheitTemperature - 32) * 5) / 9;
cout << "Temperature in celsius : " << temperatureInCelsius;
return 0;
}
Program : To calculate factorial of a given number
cpp
#include <iostream>

using namespace std;

int main() {
int num,res=1;
cout << "Enter a positive number:" << endl;
cin >> num;
if(num < 0){
cout << "You entered a negative number" << endl;
}
else if(num == 0){
cout << "0! = " << "1";
}
else{
for(int i = 1;i <= num;i++){
res = res * i;
}
cout << "Factorial of " << num << " is "<<res;
}

return 0;
}
Program: Given an array with numbers 11,12,13,14,15 calculate the sum of elements in array using range based for loop.
cpp
#include <iostream>

using namespace std;

int main(){
int numbers[] = {11,12,13,14,15};
int sum = 0;
for(int number : numbers){
sum = sum + number;
}
cout << "Sum = "<< sum;
return 0;
}
Program : Design a number guessing game using while loop.
Take range of numbers from 1 - 10
hard code any number between 1 and 10
Ask user to guess the number after guessing display number of attempts made to guess the number.
cpp
#include <iostream>

using namespace std;

int main()
{
int numberToGuess = 4;
int attempts = 0;
int guess = 0;
while (guess != numberToGuess)
{
cout << "Guess the number between 1 and 10:" << endl;
cin >> guess;
attempts++;
if(guess == numberToGuess){
cout << "You guessed it right in " << attempts << " attempts" << endl;
}
}
cout << "Game ended";
return 0;
}
Program : Design a number guessing game using while loop.
Take range of numbers from 1 - 10
hard code any number between 1 and 10
Ask user to guess the number after guessing display number of attempts made to guess the number.
cpp
#include <iostream>

using namespace std;

int main()
{
int numberToGuess = 4;
int attempts = 0;
int guess = 0;
while (guess != numberToGuess)
{
cout << "Guess the number between 1 and 10:" << endl;
cin >> guess;
attempts++;
if(guess == numberToGuess){
cout << "You guessed it right in " << attempts << " attempts" << endl;
}
}
cout << "Game ended";
return 0;
}
❀4πŸ‘1
🌟 Unlock Your Career in C++ & DSA! 🌟

Are you ready to dive into the world of programming? πŸ’»βœ¨ We have the *ultimate* collection of C++ and DSA courses that can set you on the path to success! πŸš€

πŸ”΅ C++ & C++ with DSA Masterclass
πŸ’‘ ALPHA DSA C++ - Stand Out in the Crowd!
πŸš€ PW C++ DSA - Propel Your Skills!
πŸ”₯ Love Babbar Supreme Batch - Learn from the Best!
πŸ“˜ DSA by Abdul Bari - Expert Guidance!
βœ… NARESH IT DSA - Proven Techniques!
😱 Durgasoft DSA - Grab Your Opportunity!
🀑 Ashok IT - Fun and Engaging Learning!

✨ Exclusive Offer: Get Access for Only β‚Ή100! ✨
Originally valued at β‚Ή10,000, this is your chance to grab it at an unbelievable 1% of the price! πŸ’°

Don’t miss out on this incredible opportunity to enhance your skills and boost your career! πŸ™Œ

πŸ’¬ Message us now at:
@Myhurthearts
@imabhi3030

🌈 Invest in your future today! 🌈
πŸ‘2
Program : Sum on n natural numbers using do while loop.
#include <iostream>

using namespace std;

int main() {
int n,sum=0,i=1;
cout << "Enter the value of n:";
cin >> n;
do{
sum = sum + i;
i++;
}while(i <= n);
cout << "Sum of "<< n << " natural numbers :" << sum;
}
πŸ‘3
Program : Write a function to find maximum of two numbers.
#include <iostream>

using namespace std;
int findMax(int n1 , int n2){
if(n1 > n2){
return n1;
}
return n2;
}

int main() {
int num1,num2;
cout << "Enter any two different numbers:"<<endl;
cin >> num1 >> num2;
int max = findMax(num1,num2);
cout << "Maximum of "<< num1 << " and " << num2 << " is " << max;
return 0;
}
πŸ‘3
Program : Write a function to find maximum of two numbers.
#include <iostream>

using namespace std;
int findMax(int n1 , int n2){
if(n1 > n2){
return n1;
}
return n2;
}

int main() {
int num1,num2;
cout << "Enter any two different numbers:"<<endl;
cin >> num1 >> num2;
int max = findMax(num1,num2);
cout << "Maximum of "<< num1 << " and " << num2 << " is " << max;
return 0;
}
πŸ‘3
🌟 Unlock Your Career in C++ & DSA! 🌟

Are you ready to dive into the world of programming? πŸ’»βœ¨ We have the *ultimate* collection of C++ and DSA courses that can set you on the path to success! πŸš€

πŸ”΅ C++ & C++ with DSA Masterclass
πŸ’‘ ALPHA DSA C++ - Stand Out in the Crowd!
πŸš€ PW C++ DSA - Propel Your Skills!
πŸ”₯ Love Babbar Supreme Batch - Learn from the Best!
πŸ“˜ DSA by Abdul Bari - Expert Guidance!
βœ… NARESH IT DSA - Proven Techniques!
😱 Durgasoft DSA - Grab Your Opportunity!
🀑 Ashok IT - Fun and Engaging Learning!

Don’t miss out on this incredible opportunity to enhance your skills and boost your career! πŸ™Œ

πŸ’¬ Message us now at:
@Myhurthearts
@imabhi3030

🌈 Invest in your future today! 🌈
Which of the following is the correct way to write a comment in C?
Anonymous Quiz
55%
// This is a comment
35%
/* This is a comment */
7%
# This is a comment
3%
-- This is a comment
What is the correct format specifier for printing a float in C?
Anonymous Quiz
9%
%d
80%
%f
9%
%c
4%
%s
Which operator is used to access the value at the address stored in a pointer?
Anonymous Quiz
38%
&
43%
*
11%
@
9%
#
Which keyword is used to define a constant in C?
Anonymous Quiz
23%
constant
8%
define
63%
const
6%
static
What are assignment operator ?
Anonymous Quiz
48%
=
12%
& , || , !=
30%
< , > <= , >=
10%
+ , - , * / , %
πŸ‘1
🌟 Unlock Your Career in C++ & DSA! 🌟

Are you ready to dive into the world of programming? πŸ’»βœ¨ We have the *ultimate* collection of C++ and DSA courses that can set you on the path to success! πŸš€


πŸ”΅
C++ & C++ with DSA Masterclass
πŸ’‘ ALPHA DSA C++ - Stand Out in the Crowd!
πŸš€ PW C++ DSA - Propel Your Skills!
πŸ”₯ Love Babbar Supreme Batch - Learn from the Best!
πŸ“˜ DSA by Abdul Bari - Expert Guidance!
βœ… NARESH IT DSA - Proven Techniques!
😱 Durgasoft DSA - Grab Your Opportunity!
🀑 Ashok IT - Fun and Engaging Learning!
Ineuron All DSA course & 10+ more DSA courses

Don’t miss out on this incredible opportunity to enhance your skills and boost your career! πŸ™Œ


πŸ’¬ Message us now at:
@Myhurthearts
@imabhi3030

🌈 Invest in your future today! 🌈

Join for Free Course βœ… https://t.me/addlist/vnAFuK9rY6FjNjM1
πŸ‘Ž1