Afaq Ahmad Khan

sizeof operator Program in C

/*Program to understand the sizeof operator*/ #include<stdio.h> int main(void) { int var; printf(“Size of int=%u\n”,sizeof(int)); printf(“Size of float=%u\n”,sizeof(float)); printf(“Size of var=%u\n”,sizeof(var)); printf(“Size of an integer constant=%u\n”,sizeof(45)); return 0; } Output: Size of int=4 Size of float=4 Size of var=4 Size of an integer constant=4

Comma operator Program in C

/*Program to understand the use of comma operator*/ #include<stdio.h> int main(void) { int a,b,c,sum; sum = (a=8,b=7,c=9,a+b+c); printf(“Sum=%d\n”,sum); return 0; } Output: Sum=24

Print the larger of two numbers using conditional operator Program in C

/*Program to print the larger of two numbers using conditional operator */ #include<stdio.h> int main(void) { int a,b,max; printf(“Enter values for a and b :”); scanf(“%d%d”,&a,&b); max = a>b ? a : b; /*ternary operator*/ printf(“Larger of %d and %d is %d\n”,a,b,max); return 0; } Output: Enter values for a and b :5 7 Larger […]

Relational operators Program in C

/*Program to understand the use of relational operators*/ #include<stdio.h> int main(void) { int a,b ; printf(“Enter values for a and b : “); scanf(“%d%d”,&a,&b); if(a<b) printf(“%d is less than %d\n”,a,b); if(a<=b) printf(“%d is less than or equal to %d\n”,a,b); if(a==b) printf(“%d is equal to %d\n”,a,b); if(a!=b) printf(“%d is not equal to %d\n”,a,b); if(a>b) printf(“%d is […]

UP Board Class 6 Math अभ्यास – 1(b) प्राकृतिक संख्याएँ

प्रश्न 1. निम्नांकित सारणियों में रिक्त स्थानों की पूर्ति के लिए सारणी के नीचे चार विकल्प दिए गए हैं। जिनमें से केवल एक ही सही है। सही विकल्प चुनकर रिक्त स्थानों की पूर्ति कीजिए। 23 24 25 … 27 उत्तर-(iii) 26 प्रश्न 2. निम्नांकित सारणियों में रिक्त स्थानों की पूर्ति के लिए सारणी के नीचे […]

UP Board Class 6 Math अभ्यास – 1(a) प्राकृतिक संख्याएँ

प्रश्न 1. निम्नांकित संख्याओं को संख्यांकों में व्यक्त कीजिए : उत्तर- (i) चार सौ सत्ताईस – 427 (ii) तीन हजार पाँच सौ एक – 3501 (iii) एक सौ पन्द्रह – 115 (iv) उन्यासी हजार उनतीस – 79029 प्रश्न 2:- (अ) निम्नांकित संख्याओं को शब्दों में लिखिए : उत्तर- (i) 7019 – सात हजार उन्नीस (ii) […]

Prefix increment/decrement Program in C

/*WAP for Prefix increment/decrement*/ #include<stdio.h> #include<stdio.h> int main(void) { int x=8; printf(“x=%d\t”,x); printf(“x=%d\t”,++x); /*Prefix increment*/ printf(“x=%d\t”,x); printf(“x=%d\t”,–x); /*Prefix decrement*/ printf(“x=%d\n”,x); return 0; } Output: x=8 x=9 x=9 x=8 x=8

Understand the floating point arithmetic operations Program in C

/*Write a Program to understand the floating point arithmetic operations */ #include<stdio.h> int main(void) { float a=12.4,b=3.8; printf(“Sum=%.2f\n”,a+b); printf(“Difference=%.2f\n”,a-b); printf(“Product=%.2f\n”,a*b); printf(“a/b=%.2f\n”,a/b); return 0; } Output: Sum=16.20 Difference=8.60 Product=47.12 a/b=3.26

Integer arithmetic operations Program in C

WAP Integer arithmetic operations in C Language. /*Integer arithmetic operations in C Language*/ #include<stdio.h> int main(void) { int a=17,b=4; printf(“Sum=%d\n”,a+b); printf(“Difference=%d\n”,a-b); printf(“Product=%d\n”,a*b); printf(“Quotient=%d\n”,a/b); printf(“Remainder=%d\n”,a%b); return 0; } Output: Sum=21 Difference=13 Product=68 Quotient=4 Remainder=1

Find out the size and limits of data types Program in C

WAP to find out the size and limits of data types in C Language. /*Program to find out the size and limits of data types*/ #include<stdio.h> #include<limits.h> #include<float.h> int main(void) { printf(“sizeof(char) = %u\n”,sizeof(char)); printf(“sizeof(short) = %u\n”,sizeof(short)); printf(“sizeof(int) = %u\n”,sizeof(int)); printf(“sizeof(long) = %u\n”,sizeof(long)); printf(“sizeof(float) = %u\n”,sizeof(float)); printf(“sizeof(double) = %u\n”,sizeof(double)); printf(“sizeof(long double) = %u\n”,sizeof(long double)); printf(“SCHAR_MIN […]

1 6 7 8 9 10 34