0% found this document useful (0 votes)
2 views3 pages

C Appti 2

The document contains multiple C programming code snippets demonstrating various concepts such as variable assignment, loops, switch statements, and conditional statements. Each snippet illustrates different behaviors and outcomes, including the use of commas in assignments, the impact of the continue statement in loops, and the results of switch cases with character values. Overall, these examples serve as practical illustrations of C syntax and control flow.

Uploaded by

physicstutormcq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

C Appti 2

The document contains multiple C programming code snippets demonstrating various concepts such as variable assignment, loops, switch statements, and conditional statements. Each snippet illustrates different behaviors and outcomes, including the use of commas in assignments, the impact of the continue statement in loops, and the results of switch cases with character values. Overall, these examples serve as practical illustrations of C syntax and control flow.

Uploaded by

physicstutormcq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

int main(){
int a=(10,11,12);
printf("%d",a);
}
------------------------------------
2.

int main(){
int a;
a=(10,11,12);
printf("%d",a);
}
--------------------------------------
3.

int main(){
int a=10,b=1;
for(;a;printf("%d %d\n",a,b)){
a=++b<=7;
}
return 0;
}
----------------------------------------
4.

int cal(){
int num=10;
return num--;
}
int main(){
for(cal();cal();cal()){
printf("%d\n",cal());
}
return 0;
}
-------------------------------------------
5.

int main(){
int i;
for(i=0;i<=15;i+= 3);
printf("%d",i);
}
------------------------------------------------
6.

int main()
{
int a = 65;
switch(a)
{
case 65: printf("c");
break;
case 'A': printf("java");
break;
default:
printf("not valid");
}
return 0;
}

---------------------------------------------------
7.

int main()
{
int a = 65;
switch(a)
{
case 65: printf("c");
break;
case 'a': printf("java");
break;
default:
printf("not valid");
}
return 0;
}
------------------------------------------
8.
#include <stdio.h>
int main() {
int i = 10;
while (i++ <= 10) {
printf("%d ", i);
}
printf("%d", i);
return 0;
}

-------------------------------
9.
#include <stdio.h>
int main() {
int i = 0;
for (i = 0; i < 5; i++) {
if (i == 3)
continue;
printf("%d ", i);
}
return 0;
}

--------------------------------
10.
#include <stdio.h>
int main() {
int i = 0;
while (i < 5) {
if (i == 2) {
i++;
continue;
}
printf("%d ", i);
i++;
}
return 0;
}

You might also like