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

Assignment Day1

Uploaded by

prachikpo2733
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)
6 views3 pages

Assignment Day1

Uploaded by

prachikpo2733
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

PROGRAM 1

#include <stdio.h>

int main() {
int a,b,sum;
printf("Enter 2 Numbers for addition : ");
scanf("%d %d",&a,&b);

sum = a+b;
printf("The addition of numbers is : %d",sum);
return 0;
}

PROGRAM 2

#include <stdio.h>

int main() {
int num,square,cube;
printf("Enter number : ");
scanf(" %d",&num);
square = num*num;
cube = num*num*num;

printf(" Square of number is : %d and cube of number is : %d",square,cube);

return 0;
}

PROGRAM 3

#include <stdio.h>

int main() {
int number;
printf("Enter a number to check if it is even or odd");
scanf("%d", &number);

if(number%2==0)
printf("The given number is even");
else
printf("The given number is odd");

return 0;
}

PROGRAM 4

#include <stdio.h>

int main() {
int number;
printf("Enter a number : ");
scanf("%d", &number);
if(number<0)
printf("The given number is negative");
else if(number==0)
printf("The given number is Zero");
else
printf("The given number is Positive");

return 0;
}

PROGRAM 5

#include <stdio.h>

int main() {
int marks;
printf("Enter your marks : ");
scanf("%d", &marks);

if(marks>=75)
printf("Your grade is A");
else if(marks<75 && marks>=55)
printf("Your grade is B");
else if(marks<55 && marks>=40)
printf("Your grade is C");
else
printf("You have FAILED");

return 0;
}

PROGRAM 6

#include<stdio.h>

int main()
{
int num1,num2,max;

printf("Enter 2 numbers : ");


scanf("%d %d",&num1,&num2);

printf("\nMaximum number : %d", (num1>num2?num1:num2));

return 0;
}

PROGRAM 7

PROGRAM 8

PROGRAM 9
PROGRAM 10

PROGRAM 11

PROGRAM 12

You might also like