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

Assignment Raj CPPM

cppm assignment

Uploaded by

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

Assignment Raj CPPM

cppm assignment

Uploaded by

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

Assignment-I

Assignment
Name :- Rajput Raj
Enrollment :-
Subject :- Computer Programming and Programming Methodology (CPPM)
Faculty Name :- Priti Mam

FYBCA RAJPUT RAJ


Assignment-I

1) Write a ‘c’ Program to Print “Hello World” .

#include<stdio.h>
int main()
{
printf("Hello World");
return 0;
}
Output:-

2) Write a ‘c’ Program To get input from user using scanf.

#include <stdio.h>

int main() {
int number;
printf("Enter a number: ");
scanf("%d", &number);
printf("You entered: %d\n", number);
return 0;
}
Output:-

FYBCA RAJPUT RAJ


Assignment-I

3) Write a ‘c’ program to add two numbers.

#include <stdio.h>

int main() {
int a, b, sum;
printf("Enter two numbers: ");
scanf("%d %d", &a, &b);
sum = a + b;
printf("Sum: %d\n", sum);
return 0;
}
Output:-

4) Write a ‘c’ program to find Simple Interest.


#include <stdio.h>

int main() {
float p=12, r=13, n=10, si;

si = (p * r * n) / 100;
printf("Simple Interest: %.2f\n", si);
return 0;
}Output:-

FYBCA RAJPUT RAJ


Assignment-I

5) Write a ‘c’ Program number is even or odd.


#include <stdio.h>

int main() {
int num;
printf("Enter a number: ");
scanf("%d", &num);

if (num % 2 == 0)
printf("%d is Even\n", num);
else
printf("%d is Odd\n", num);

return 0;
}
Output:-

FYBCA RAJPUT RAJ


Assignment-I

6) Write a Program to check Positive Number.

#include <stdio.h>
int main() {
int num;
printf("Enter a number: ");
scanf("%d", &num);
if (num > 0)
printf("Number is Positive\n");
else if (num < 0)
printf("Number is Negative\n");
else
printf("Number is Zero\n");

return 0;
}
Output:-

FYBCA RAJPUT RAJ


Assignment-I

7) Write a ‘c’ program to swap two numbers without using third variable.
#include <stdio.h>

int main() {
int a=2, b=3;
a = a + b;
b = a - b;
a = a - b;

printf("After Swapping: a = %d, b = %d\n", a, b);


return 0;
}Output:-

FYBCA RAJPUT RAJ

You might also like