Jan

17

#include<conio.h>
#include<stdio.h>
void main(){
int a,b;
int s,*aptr,*bptr;
printf(“\n Enter Two integers: “);
scanf(“%d%d”,&a,&b);
aptr=&a;
bptr=&b;
s=*aptr+*bptr;

printf(“\n Sum = %d”,s);
printf(“\n &a = %d”,&a);
printf(“\n &b = %d”,&b);
printf(“\n &aptr = %d”,&aptr);
printf(“\n aptr = %d”,aptr);
printf(“\n *aptr = %d”,*aptr);
getch();
}

Filled Under: C Programming

Jan

17

#include<conio.h>
#include<stdio.h>
void main(){
int num1,num2,*big;
int *ptr1,*ptr2;
printf(“Enter two numbers: “);
scanf(“%d%d”,&num1,&num2);
ptr1=&num1;
ptr2=&num2;
if(*ptr1>*ptr2){
big=ptr1;
}
else{
big=ptr2;
}
printf(“Max is %d=”,*big);
getch();
}

Filled Under: C Programming

Jan

17

#include<conio.h>
#include<stdio.h>

struct emp{
int eno;
char ename[50];
float sal;
};
struct emp get(){
struct emp e;
printf(“Emp No: “);
scanf(“%d”,&e.eno);
printf(“Emp Name: “);
scanf(“%s”,e.ename);
printf(“Emp Sal: “);
scanf(“%f”,&e.sal);
return e;
}
void disp(struct emp e){
printf(“Emp No: %d\n”,e.eno);
printf(“Emp Name: %s\n”,e.ename);
printf(“Emp Sal: %f\n”,e.sal);
}
void main(){
struct emp e[5];//={1,”RGG”,500};
int i;
for(i=0;i<=1;i++){
printf(“Emp No: “);
scanf(“%d”,&e[i].eno);
printf(“Emp Name: “);
fflush(stdin);
gets(e[i].ename);
printf(“Emp Sal: “);
scanf(“%f”,&e[i].sal);
}
for(i=0;i<=1;i++)
disp(e[i]);
/*(em=get();
disp(em);
*/
}

Filled Under: C Programming

Jan

17

#include<conio.h>
#include<stdio.h>
typedef int integer;
struct emp{
int eno;
char ename[50];
int sal;
};
void main(){
struct emp e;
integer i;
for(i=1;i<=10;i++)
printf(“%d\n”,i);
}

Filled Under: C Programming

Jan

17

#include<stdio.h>
main(){
int i;
char name[];

//char name[]={‘H’,’E’,’L’,’L’,’O’,’H’,’E’,’L’,’L’,’O’,’H’,’E’,’L’,’L’,’O’,’\0′};
gets(name);
for(i=0;name[i]!=’\0′;i++){
printf(“%c”,name[i]);
}
printf(“\n%d\n”,strlen(name));
puts(name);
getch();
}

Filled Under: C Programming

Jan

17

#include<stdio.h>
#include<conio.h>
void main(){
int num=0,rem,temp;
printf(“Enter a number: “);
scanf(“%d”,&temp);
while(temp>0){
rem=temp%10;
num=num*10+rem;
temp=temp/10;
}
while(num>0){
rem=num%10;
num=num/10;
switch(rem){
case 0: printf(“ZERO  “);
break;
case 1: printf(“ONE  “);
break;
case 2: printf(“TWO  “);
break;
case 3: printf(“THREE  “);
break;
case 4: printf(“FOUR  “);
break;
case 5: printf(“FIVE  “);
break;
case 6: printf(“SIX  “);
break;
case 7: printf(“SEVEN  “);
break;
case 8: printf(“EIGHT  “);
break;
case 9: printf(“NINE  “);
break;
}
}
getch();
}

Filled Under: C Programming

Jan

17

#include<stdio.h>
#include<conio.h>
void main(){
int num,rem,sum=0,temp;
printf(“Enter a number: “);
scanf(“%d”,&num);
temp=num;
while(num>0){
rem=num%10;
sum=sum+(rem*rem*rem);
num=num/10;
//printf(“%d”,rem);
//printf(“\n%d\n”,sum);
}
if (temp==sum){
printf(“Armstrong number”);
}
else{
printf(“Not a Armstrong number”);
}
getch();
}

Filled Under: C Programming

Jan

17

#include<stdio.h>
#include<conio.h>
void main(){
int num1=3;
int num2=25;

int num3=num1<<1;
printf(“%d\n”,((2==2)&(2==2)));
printf(“%d\n”,(6&3));
printf(“%d\n”,(0&&3));
printf(“num1<<1= %d\n”,num3);
num3=num1>>1;
printf(“num1>>1= %d\n”,num3);
num3=num1&num2;
printf(“num1&num2= %d\n”,num3);
num3=num1|num2;
printf(“num1 | num2= %d\n”,num3);
num3=~num2;
printf(“~num1= %d\n”,num3);
num3=num1 ^ num2;
printf(“num1^num2= %d\n”,num3);
getch();
}

Filled Under: C Programming

Jan

17

#include<stdio.h>
#include<conio.h>
void main(){
int num1=3;
int num2=3;
int num3=num1&num2;
printf(“num3=%d\n”,num3>>1);
printf(“num3=%d\n”,num3<<1);
printf(“num3=%d\n”,num3);
num3=num1|num2;
printf(“num3=%d\n”,num3);
num3=num1&num2;
printf(“num3=%d\n”,num3);
printf(“num3=%d\n”,~num3);
printf(“num3=%d\n”,num1^num2);
getch();
}

 

Filled Under: C Programming

Jan

17

#include<stdio.h>
#include<conio.h>
void main(){
int num1=10;
int num2=20;
printf(“%d\n”,(num1>num2));//0
printf(“%d\n”,(num1<num2));//1
printf(“%d\n”,(num1>=num2));//0
printf(“%d\n”,(num1<=num2));//1
printf(“%d\n”,(num1==num2));//0
printf(“%d\n”,(num1!=num2));//1
getch();
}

——————————————————————————————

#include<stdio.h>
#include<conio.h>
void main(){
int num1=10;
int num2=20;

printf(“%d\n”,((num1>num2)&&(num1<num2)));//0
printf(“%d\n”,((num1>num2)||(num1<num2)));//1
printf(“%d\n”,!((num1>num2)&&(num1<num2)));//1
printf(“%d\n”,!((num1>num2)||(num1<num2)));//0
printf(“%d\n”,!(num1!=num2));//0
getch();
}

Filled Under: C Programming

Jan

17

#include<stdio.h>
void main(){
int num=10;
char ch=’a’;
short int sh=20;
printf(“%d”,sizeof(num));
printf(“\n%d”,sizeof(ch));
printf(“\n%d”,sizeof(sh));
getch();
}

Filled Under: C Programming

Jan

17

#include<stdio.h>
#include<conio.h>
#include<limits.h>
#include<float.h>
void main(){
printf(“%d   %d\n”,CHAR_MIN,CHAR_MAX);
printf(“%d   %d\n”,INT_MIN,INT_MAX);
printf(“%d   %d\n”,0,UCHAR_MAX);
printf(“%d   %ld\n”,0,UINT_MAX);
printf(“%e   %e\n”,FLT_MIN,FLT_MAX);
getch();
}

Filled Under: C Programming

Jan

17

Welcome to Ram Gopal Gupta Blog, to share our knowledge..