#include<stdio.h>
int x;
int fun(int);
void main()
{
printf("%d", fun(10));
getch();
}
int fun(int z)
{
if(z<=3)
return (z++);
else
return ((--z)*x);
}
output 0
#include<stdio.h>
int *func(int *a, int b)
{
*a+=20;
b-=10;
return a;
}
void main()
{
int *x, y=9,z=19;
x=func(&y,z);
printf("%d %d %d",*x,z,y);
getch();
}
output: 29 19 29
#include<stdio.h>
void main()
{
int d=9,a=7,e=6;
float c=2.5,f=-3.5;
printf("%f", ++a>(a--+e++)||(d==c+f)&& !(a<c));
getch();
}
output: 0.000000
#include<stdio.h>
void main()
{
int x=4,y=-2,z;
while(0<x)
{
x--;
y++;
if(x!=y)
printf("\n%d %d",x,y);
else
continue;
}
getch();
}
OUTPUT
3 -1
2 0
0 2
#include<stdio.h>
#include<string.h>
void main()
{
char s1[30];
strcpy(s1,"#CP Exam#");
char s2[30];
strcpy(s2,"$CP Exam$");
if(printf(s2)!=strlen(s1))
printf("final");
else if(printf(s1)==strlen(s1))
printf("end term");
else
printf("compre");
getch();
}
output: $CP Exam$#CP Exam#end term
#include<stdio.h>
void main()
{
int i=9,j=7;
float x=2.5,y=-3.5,c;
c=(i-5*++x)/(y--+8*j)/++y-x;
printf("\n%f",c);
getch();
}
Output: -3.45
#include<stdio.h>
int fun (int);
void main()
{
int x=8;
int fun(int x);
printf("\n%d",fun(x));
getch();
}
int fun(int x)
{
if(x>0)
return (x+fun(x-2));
}
Output: 20
#include<stdio.h>
int fun (int arr[3][])
{
arr[1][2]=3;
int i=0,j=0;
for(i=0;i<2;i++)
for(j=0;j<3;j++)
printf("%d",arr[i])[j]);
}
void main()
{
int arr[3][4]={0};
fun(arr);
getch();
}
Output: Compilation Error
#include<stdio.h>
void main()
{
char ch;
char check[12]={1,2,4,5,8,9,22,77,55};
ch=(check+1)[5];
printf("\n%d",ch);
getch();
}
Output: 22
#include<stdio.h>
#include<string.h>
void main()
{
char s1[20]="BITS";
char s2[20]="2021";
printf("\n%s",strcpy(s2,strcat(s1,s2)));
getch();
}
Output: BITS2021
#include<stdio.h>
void main()
{
int x=2;
switch(x+1,x-1)
{
case 1:
printf("BITS");
case 2:
printf("2021");
default:
printf("BITS2021");
}
getch();
}
Output:
BITS2021BITS2021
No comments:
Post a Comment