0% found this document useful (0 votes)
69 views18 pages

C Manual Outputs

The document contains C code that demonstrates variable interchange using pointers. It defines main() with integer variables a and b, prints their initial values, swaps their values using a temporary variable temp, and then prints their values again to show the interchange.

Uploaded by

sujaatkoor9090
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)
69 views18 pages

C Manual Outputs

The document contains C code that demonstrates variable interchange using pointers. It defines main() with integer variables a and b, prints their initial values, swaps their values using a temporary variable temp, and then prints their values again to show the interchange.

Uploaded by

sujaatkoor9090
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/ 18

#include<stdio.

h>

void main(){

int a,b,temp;

printf("\n enter the value of a and b");

scanf("%d %d",&a,&b);

printf("\n Enter the value of before interchange %d %d",a,b);

temp=a;

a=b;

b=temp;

printf("\n Enter the value of after interchange %d %d",a,b);

getch();

Output:-
#include<stdio.h>

void main()

int b,c,d,m;

b=4;

c=3;

d=7;

m=2*b*(c-d)/4;

printf("%d",m);

getch();

Output:

#include<stdio.h>
void main()
{
int a;
float b;
char c;
double d;
printf("\n enter the inter value for a");
scanf("%d",&a);
printf("%d",a); // %d is used to value of integer
printf("\n enter the inter value for b");
scanf("%f",&b);
printf("%f",b); // %f is used to value of float
printf("\n enter the inter value for c");
scanf("%c",&c);
printf("%c",c); // %c is used to value of character
printf("\n enter the inter value for d");
scanf("%lf",&d);
printf("%lf",d); // %lf is used to value of double
getch();
}

Output:

#include<stdio.h>

void main()
{

int n1,n2;

printf("\n enter the two numbers:");

scanf("%d %d",&n1,&n2);

(n1>n2)?printf("\n %d is biggest number",n1):printf("\n %d is biggest",n2);

getch();

Output:

#include<stdio.h>

void main()
{

int n;

printf("\n enter the number :");

scanf("%d",&n);

n=n&2;

printf("original value of n after using AND operator is %d",n);

getch();

Output:

#include<stdio.h>
void main()

int n;

printf("\n enter the number :");

scanf("%d",&n);

n=n&2;

printf("original value of n after using AND operator is %d",n);

getch();

Output:
#include<stdio.h>
void main()
{
int rem,rev_no,n;
printf("\n enter the n");
scanf("%d",&n);
while (n>0)
{
rem=n%10;
printf("%d",rem);
n=n/10;

}
getch();
}

Output:

#include<stdio.h>
void main()
{
int n, reverse_no=0,rem,original_no;
printf("\n enter a number");
scanf("%d",&n);
original_no=n;
while(n!=0)
{
rem=n%10;
reverse_no=reverse_no*10+rem;
n=n/10;
}
if(original_no==reverse_no)
printf("the number is palindrome");

else
printf("the number is not palindrome");
getch();
}

Output:

#include <stdio.h>

void main()
{

int i;

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

printf("\t %d",i);

getch();

Output:

#include<stdio.h>
#include<conio.h>
void main()
{
int smallest,greatest,i,a[10];
printf("\n Enter the ten numbers");
for(i=0;i<=10;i++)
{
scanf("%d",&a[i]);
}
smallest=a[0];
for(i=0;i<=10;i++)
{
if(smallest>a[i])
{
smallest=a[i];
}
}

printf("\n the smallest element of array is %d",smallest);

output:

greatest=a[0];
for(i=0;i<=10;i++)
{
if(a[i]>greatest)
{
greatest=a[i];
}
}

printf("\n the greatest element of array is %d",greatest);


getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
printf("\n Enter the month number");
scanf("%d",&n);
switch(n)
{
case 1:
printf("\n month \t:\t january");
printf("\n season\t:\t winter");
break;
case 2:
printf("\n month \t:\t february");
printf("\n season\t:\t winter");
break;
case 3:
printf("\n month \t:\t march");
printf("\n season\t:\t summer");
break;
case 4:
printf("\n month \t:\t april");
printf("\n season\t:\t summer");
break;
case 5:
printf("\n month \t:\t may");
printf("\n season\t:\t summer");
break;
case 6:
printf("\n month \t:\t june");
printf("\n season\t:\t rainy");
break;
case 7:
printf("\n month \t:\t jully");
printf("\n season\t:\t rainy");
break;
case 8:
printf("\n month \t:\t augast");
printf("\n season\t:\t rainy");
break;
case 9:
printf("\n month \t:\t september");
printf("\n season\t:\t rainy");
break;
case 10:
printf("\n month \t:\t octomber");
printf("\n season\t:\t rainy");
break;
case 11:
printf("\n month \t:\t november");
printf("\n season\t:\t winter");
break;
case 12:
printf("\n month \t:\t december");
printf("\n season\t:\t winter");
break;
}
getch();
}

Output:
#include<stdio.h>

#include<conio.h>

void main() {

int i,j;

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

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

int sum[3][3];

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

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

sum[i][j]=matrix1[i][j]+matrix2[i][j];

printf("The sum of the two matrices is: \n");

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

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

printf("%d\t",sum[i][j]);

printf("\n");

getch();

}
#include <stdio.h>

#include <conio.h>

void main() {

int phy,chem,bio,math,comp;

float per;

/* Input marks of five subjects from user */

printf("Enter five subjects marks: ");

scanf("%d%d%d%d%d", &phy, &chem, &bio, &math, &comp);

/* Calculate percentage */

per = (phy + chem + bio + math + comp) / 5.0;

printf("Percentage = %.2f\n", per);

/* Find grade according to the percentage using logical operators */

if(per >= 90.0)

printf("Grade: Distinction\n");

else if((per >= 80.0) && (per < 90.0))

printf("Grade: First Class\n");

else if((per >= 70.0) && (per < 80.0))

printf("Grade: Second Class\n");

else if((per >= 60.0) && (per < 70.0))

printf("Grade: Pass Class\n");

else

printf("Grade: Fail\n");

getch();

}
#include<stdio.h>

#include<conio.h>

int main() {

float per;

/* Input percentage from user */

printf("Enter percentage: ");

scanf("%f", &per);

/* Find grade according to the percentage */

if(per >= 75.0)

printf("Grade: Distinction\n");

else if(per >= 60.0)

printf("Grade: A\n");

else if(per >= 55.0)

printf("Grade: B\n");

else if(per >= 40.0)

printf("Grade: Pass\n");

else

printf("Grade: Fail\n");

getch();

}
#include<stdio.h>
void main()
{
int i,j,n=1;
for(i=1;i<=4;i++)
{
for(j=5;j>=1;j--)
{
if(j>i)
{
printf(" ");

}
else
{
printf(" %d",n++);
}
}
printf("\n");
}
getch();
}

You might also like