Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 (24 pts): What is the output of the following questions: #include int main() { int i, a[5] = {1, 3, 5, 1, 6};

Question 1 (24 pts): What is the output of the following questions:

#include

int main() {

int i, a[5] = {1, 3, 5, 1, 6};

for(i=1; i <= 5; i++)

if(i<4)

a[i] = a[i-1] + a[i+1];

else

a[i%5]=a[i-1]+a[(i+1)%5];

for(i=0;i<5;i++)

printf("%d ",a[i]);

return 0;

}

#include

int main() {

int i,j, k ;

int b[3][3]={{2,1,9},{4,5,6},{1,6,8}};

for (k=0;k<3;k++) {

j=0;

for (i=k;i>=0;i--){

printf("%d ",b[i][j]);

j++;

}

printf(" ");

}

return 0;

}

#include

int main() {

int a=20,b=13,c;

int *p1,*p2;

p1=&a;

p2=&b;

*p1=2+*p2;

*p2=a+3;

c=a+b;

printf("%d %d %d",a+b,b,c);

return 0;

}

#include

int main(){

int count=0,m,n;

m=2;

do{

n=9;

while(n>=4){

count++;

n=n-2;

}

m=m+2;

}while(m<=4);

printf("%d %d %d ",m,n,count);

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions