Skip to main content

Posts

Showing posts from November, 2020

Write a C program to perform Switch & Break.

 Que : Write a C program to perform Switch & Break. ans :      

what is C language and its inroduction.

INTRODUCTION to C C is a general-purpose programming language that is extremely popular, simple and flexible. It is machine-independent, structured programming language which is used extensively in various applications. C was the basic language to write everything from operating systems (Windows and many others) to complex programs like the Oracle database, Git, Python interpreter and more. Why learn 'c'? 'C' is a base language for many programming languages. So, learning 'C' as the main language will play an important role while studying other programming languages. It shares the same concepts such as data types, operators, control statements and many more. 'C' can be used widely in various applications. It is a simple language and provides faster execution. How 'c' Work? A is a compiled language. A compiler is a special tool that compiles the program and converts it into the object file which is machine readable. After the compilation process...

Write a C program to perform AND, OR & XOR operation between two integers.

Que: Write a C program to perform AND operation between two integers. Ans :  #include <stdio.h> int main() {     int a = 12, b = 25;     printf("Output = %d", a&b);     return 0; } INPUT:   OUTPUT:

write a C program to demonstrate the Relational & Logical operator.

  Q1) write a C program to demonstrate the relational operator.   Ans :- #include <stdio.h> int main() {     int a,b,c;     printf("Enter the three digits :)");     scanf("\n%d %d %d",&a,&b,&c);     printf("\n%d==%d",a,b,a == b);     printf("\n%d==%d is %d",c,b,c == b);     printf("\n%d>%d is %d",a,b,a > b);     printf("\n%d>%d is %d",c,b,c > b);     printf("\n%d<%d is %d",a,b,a < b);     printf("\n%d<%d is %d",c,b,c < b);     printf("\n%d!=%d is %d",a,b,a != b);     printf("\n%d!=%d is %d",c,b,c != b);     printf("\n%>=%d is %d",a,b,a >= b);     printf("\n%d>=%d is %d",c,b,c >= b);     printf ("\n%d<=%d is %d",a,b,a <= b);     printf("\n%d<=%d is %d",c,a,c <=b);     return 0; } input : output : Q2)write A C PROGRAM TO DEMONSTRATE THE      ...

Bitwise Operators in C Programming

  Bitwise AND operator & In this tutorial you will learn about all 6 bitwise operators in C programming with examples. The output of bitwise AND is 1 if the corresponding bits of two operands is 1. If either bit of an operand is 0, the result of corresponding bit is evaluated to 0. Let us suppose the bitwise AND operation of two integers 12 and 25. 12 = 00001100 (In Binary) 25 = 00011001 (In Binary) Bit Operation of 12 and 25 00001100 & 00011001 ________ 00001000 = 8 (In decimal) Example #1: Bitwise AND # include <stdio.h> int main () { int a = 12 , b = 25 ; printf ( "Output = %d" , a&b); return 0 ; } Output Output = 8 Bitwise OR operator | The output of bitwise OR is 1 if at least one corresponding bit of two operands is 1. In C Programming, bitwise OR operator is denoted by |. 12 = 00001100 (In Binary) 25 = 00011001 (In Binary) Bitwise OR Operation of 12 and 25 00001100 | 00011001 ________ 00011101 = 29 (In decimal) Exampl...