0% found this document useful (0 votes)
7 views6 pages

Assignment

code in c language

Uploaded by

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

Assignment

code in c language

Uploaded by

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

Ques.

Addition

#include<stdio.h>
int main()
{
int a,b;
printf("write first number\n");
scanf("%d",&a);
printf("write second number\n");
scanf("%d",&b);
printf("sum of %d and %d is %d",a,b,a+b);
return 0;
}

substraction

#include<stdio.h>
int main()
{
int a,b;
printf("write first number\n");
scanf("%d",&a);
printf("write second number\n");
scanf("%d",&b);
printf("substraction of %d and %d is %d",a,b,a-b);
return 0;
}

multiplication

#include<stdio.h>
int main()
{
int a,b;
printf("write first number\n");
scanf("%d",&a);
printf("write second number\n");
scanf("%d",&b);
printf("multiplication of %d and %d is %d",a,b,a*b);40
return 0;
}
average

#include<stdio.h>
int main()
{
int a,b;
printf("write first number\n");
scanf("%d",&a);
printf("write second number\n");
scanf("%d",&b);
printf("average of %d and %d is %d",a,b,(a+b)/2);
return 0;
}
Ques 2(A)

#include<stdio.h>
int main()
{
char k;
printf("write a character\n");
scanf("%c",&k);
printf(" *\n");
printf(" * * \n");
printf(" * * *\n");
printf(" * * * *\n");
printf(" * * *\n");
printf(" * *\n");
printf(" *");
return 0;
}
Ques.2(B)

#include<stdio.h>
int main()
{
char character;
printf("enter a character\n");
scanf("%c",&character);
printf("ASCII value of %c=%d",character,character);
return 0;

You might also like