C PROGRAMMING
الذهاب إلى القناة على Telegram
لا توجد بيانات
المشتركون
-824 ساعات
-347 أيام
+8830 أيام
أرشيف المشاركات
// Binary to Decimal By C
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
int rem,num,i=0,Deci=0;
char Oct[50];
printf("Enter Binary no: ");
scanf("%d", &num); //Taking num
int j,numb =num;
while(numb>0) { // Check binary
j=numb%10;
if( j!=0 && j!=1 ) {
printf("number is not binary");
exit(0);
}
numb=numb/10;}
if(num!=0){
while(num>0){ // Oct to Dec Func
rem = num % 10;
Deci=Deci+rem*pow(2,i++);
num=num/10; }
}
else{
printf("Decimal and Octal Value is 0");
exit (0);
}
printf("Decimal Number is %d",Deci);
rem=0;
i=0;
while(Deci>0){ // Dec to Oct
Oct[i++]=Deci%8;
Deci =Deci/8;
}
printf("\nOctal Number is ");
for(j=i-1;j>=0;j--){
printf("%d",Oct[j]);
}
return 0;
}
/*JOIN ALL IMPORTANT COURSE - 👉🏻 https://t.me/addlist/c3QWwWR-Iw4xMDNlNOTE - Alpha delta and supreme batch course are include in this channel
Free for all 😁feel free to ask @imabhi3030
Javascript full course - https://t.me/Javascript_Course_js
full stack web devloper course - https://t.me/web_devloper_bro
Ethical hacking full course - https://t.me/Ethical_hackings_course
Reacts & nodejs full course - https://t.me/Reacts_Course
Linux full course - https://t.me/Linux_Courses
Python devloper full course - https://t.me/Python_Devloper
Machine learning & ai course - https://t.me/Machine_learnings_Ai
Android apps devloper full course - https://t.me/Mobile_Apps_devlopment
JOIN ALL IMPORTANT COURSE - 👉🏻 https://t.me/addlist/c3QWwWR-Iw4xMDNl
// Checking binary Number
#include<stdio.h>
#include<conio.h>
int main() {
int j,num;
printf("Please enter a number :");
scanf("%d",&num);
while(num>0) {
j=num%10;
if( j!=0 && j!=1 ) {
printf("num is not binary");
break;
}
num=num/10;
if(num==0) {
printf("num is binary");
}
}
getch();
}// Complex Numbers adding with friend function
#include<iostream>
using namespace std;
class Complex{
int a,b;
public:
friend Complex sumComplex(Complex o1, Complex o2);
void setNumber(int n1, int n2){
a=n1;
b=n2;
}
void printNumber(){
cout<<"Your number is "<<a<<" + "<<b<<"i"<<endl;
}};
Complex sumComplex(Complex o1, Complex o2){
Complex o3;
o3.setNumber((o1.a + o2.a), (o1.b + o2.b));
return o3;
}
int main(){
Complex c1,c2, sum;
c1.setNumber(1, 4);
c1.printNumber();
c2.setNumber(3, 6);
c2.printNumber();
sum = sumComplex(c1, c2);
sum.printNumber();
return 0;
}
/*
Output:
Your number is 1 + 4i
Your number is 3 + 6i
Your number is 4 + 10i
*/// 2 Numbers adder
#include<iostream>
using namespace std;
int main (){
int num1,num2, res;
cout<<"Enter first number : ";
cin>>num1;
cout<<"Enter second number : ";
cin>>num2;
res=num1+num2;
cout<<"Total: "<<res;
return 0;
}Which of the following output can be possible for given line in C Programming:- int a = 5;
printf("%d %d %d\n", a, ++a , a++);
// Binary to Decimal By C
#include<stdio.h>
#include<math.h>
int main()
{
int rem,num,i=0,Deci=0;
printf("Enter Binary no: ");
scanf("%d", &num);
if(num!=0){
while(num>0){
rem = num % 10;
Deci=Deci+rem*pow(2,i++);
num=num/10; }
}
else{
printf("0");
}
printf("Decimal Number is %d",Deci);
return 0;
}What will be the output of the following C code?
void main()
{
int x = 10;
int y = x++ + 20;
printf("%d,%d",x,y);
return 0;
}`Join for all programming language more than 30+ channel you must join here useful channel like programming, hacking, notes everything 😁```
👉 https://t.me/addlist/5MDFVZjV1Yo2NWI1Try our new bot @imabhiAI_bot for coding compiler just reply the coding then get output
𝐍ᴀᴅᴀɴ 𝐏ᴀʀɪɴᴅᴇ:
𝗥𝗲𝗮𝗹𝘁𝗶𝗺𝗲 𝗶/𝗼 𝗰𝗼𝗺𝗽𝗶𝗹𝗲𝗿 𝗯𝗼𝘁
=========================
Compilation commands
=========================
/code or /cc for c
/py or /python
/js or /node
/cpp or /cplus
/jv or /java
/go for golang
/ts or /type for typescript
/sql for sql
Wait for update for more info @imabhi3030
// Decimal to Binary By C
#include<stdio.h>
int main()
{
int rem,num,i=1,j;
char Bin[50];
printf("Enter Decimal no: ");
scanf("%d", &num);
if(num!=0){
while(num!=0){
rem = num % 2;
Bin[i++]= rem+48;
num=num/2; }
}
else{
printf("0");
}
printf("Binary Number is ");
for(j=i+1;0<j;j--){
printf("%c",Bin[j]);
}
return 0;
}// Decimal to Octal By C
#include<stdio.h>
int main()
{
int rem,num,i=1,j;
char Oct[50];
printf("Enter Decimal no: ");
scanf("%d", &num);
if(num!=0){
while(num!=0){
rem = num % 8;
Oct[i++]= rem+48;
num=num/8; }
}
else{
printf("0");
}
printf("\nOctal Number is ");
for(j=i+1;0<j;j--){
printf("%c",Oct[j]);
}
return 0;
}Join for all programming language more than 30+ channel you must join here useful channel like programming, hacking, notes everything 😁``
👉 https://t.me/addlist/5MDFVZjV1Yo2NWI1