Basic Programming Language Lectures for BE-Mechanical for TCS
TCS has started hiring for Season-2021 and Coding is one of the screening round of the process.
As coding practice is essential for Mechanical Students.
Thanks & Regards
Mr. Avinash Mote | Dean TPII (Training, Placement & Industry Interaction)
Training & Placement Department
SVERI’s C.O.E. Pandharpur (PAH Solapur University)
"Engineering for Excellence"
Mob - 8698303387, 9403084879
Web- http://www.sveri.ac.in
Mail – placement@sveri.ac.in | aamote@coe.sveri.ac.in
Note: Please join at sharp timing. 5 minutes late coming will be allowed. After that you will not be allowed in the Google Meet Session.
Please help me and yourself.
Regards,
Sachin Bhosale
Only one request to students, please join session sharp at 14:00. 5 minutes allowance will be given. After 5 minutes entry will be restricted.
Sorry to say but admitting late Students creates disturbance for me and other students those who join on time.
Please help all to join on time.
🙏😊
/*
A C program to understand increment and decrement operators
++
--
pre-increment ++i
post-increment i++
pre-decrement --i
post-decrement i--
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,d;
int e,f,g,h;
clrscr();
a=2;
b=2;
c=2;
d=2;
//First Part Commenting
//pre-increment ++i
++a;
//post-increment i++
b++;
//pre-decrement --i
--c;
//post-decrement i--
d--;
//Let's print values of a,b,c and d
printf("\n a=%d,b=%d,c=%d,d=%d",a,b,c,d);
//Second Part Commenting
/*
e=++a;
f=b++;
g=--c;
h=d--;
printf("\n e=%d,f=%d,g=%d,h=%d",e,f,g,h);
*/
getch();
}
/*
Output with Second part commenting
a=3,b=3,c=1,d=1
Output with first part commenting
e=3,f=2,g=1,h=2
*/
-----------------------
/*
A C program to understand Unary Opertor (Unary Minus)
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a=2;
clrscr();
printf("\n -a=%d",-a);
getch();
}
/*
Output:
-a=-2
*/
-----------------------
/*
A C program to understand conditional operator
variable=logical condition?value1:value2;
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
a=20;
b=5;
printf("\na=%d,b=%d",a,b);
c=a>b?100:200;
printf("\nc=%d for c=a>b?100:200;",c);
c=a<b?100:200;
printf("\nc=%d for c=a>b?100:200;",c);
getch();
}
/*
Output:
a=20,b=5
c=100 for c=a>b?100:200;
c=200 for c=a>b?100:200;
*/
----------------------
/*
A C program to understand sizeof operator
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a=2000;
float b=54.342;
char c='#';
clrscr();
printf("\na=%d,b=%f,c=%c",a,b,c);
printf("\nsizeof(a)=%d bytes",sizeof(a));
printf("\nsizeof(b)=%d bytes",sizeof(b));
printf("\nsizeof(c)=%d bytes",sizeof(c));
printf("\nsizeof(int)=%d bytes",sizeof(int));
printf("\nsizeof(float)=%d bytes",sizeof(float));
printf("\nsizeof(char)=%d bytes",sizeof(char));
getch();
}
/*
Output:
a=2000,b=54.341999,c=#
sizeof(a)=2 bytes
sizeof(b)=4 bytes
sizeof(c)=1 bytes
sizeof(int)=2 bytes
sizeof(float)=4 bytes
sizeof(char)=1 bytes
*/
--------------------------
/*
A C program to understand comma operator
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
c=(a=5,b=10,a+b);
printf("\nc=%d for c=(a=5,b=10,a+b);",c);
c=(a+b,a=5,b=10);
printf("\nc=%d for c=(a+b,a=5,b=10);",c);
c=(a+b,b=10,a=5);
printf("\nc=%d for c=(a+b,b=10,a=5);",c);
c=(a=5,b=10,a+b,a*b);
printf("\nc=%d for c=(a=5,b=10,a+b,a*b);",c);
getch();
}
/*
Output:
c=15 for c=(a=5,b=10,a+b);
c=10 for c=(a+b,a=5,b=10);
c=5 for c=(a+b,b=10,a=5);
c=50 for c=(a=5,b=10,a+b,a*b);
*/
Google Meet Video Session:
For Higher Resolution:
No comments:
Post a Comment