C program to that takes two numbers and print their sum, difference,division and mod.Simple programs
#include <stdio.h>
int main()
{
int
a;
int b;
int sum;
int remainder;
int
difference;
int product;
int quotiant;
printf("enter first number");
scanf("%d",&a);
printf("enter second number");
scanf("%d",&b);
sum=a+b;
remainder=a%b;
difference=a-b;
product=a*b;
quotiant=a/b;
printf("sum=%d\n",sum);
printf("remainder=%d\n",remainder);
printf("difference=%d\n",difference);
printf("product=%d\n",product);
printf("quotiant=%d\n",quotiant);
return 0;
}
OUT PUT :
C program that print the numbers 1
to 4 on the same line.
#include <stdio.h>
int main()
{
int num1;
int num2;
int num4;
int num3;
printf("1 2 3 4 ");
printf("\n1 2 3 4\n");
("%d %d %d %d",&num1,&num2,&num3,&num4);
printf("\n1 ");
printf("2 ");
printf("3 ");
printf(" 4\n");
return 0;
}
OUT PUT :
C program for matric board
examination registration bu using if statement.
#include<stdio.h>
void main()
{
int age;
for(int i=0; i<10;
i++)
{
printf("Enter
your age for matric board registration:");
scanf("%d",&age);
if(age>=16 && age<=20)
{
printf("Your registration number is %d\n",i+1*100*2*age);
}
if(age>20)
{
printf("You are over age\n");
}
if(age<16)
{
printf("Your age is not required for matric board
registration\n");
printf("Please apply when you become 16 year old\n");
}
}
OUT PUT :
https://plus.google.com/u/0/113137764248461079787/postsThere are some related sites links.
https://plus.google.com/u/0/b/116547007964498368177/116547007964498368177/posts
No comments:
Post a Comment