Silence for Solutions

P1.
#include <stdio.h>
#include <conio.h>
void main()
{
printf("\n Welcome");
getch();
}

P2.
#include <stdio.h>
#include <conio.h>
void main()
{
int a,b,c;
printf("Enter First no.\n");
scanf("%d",&a);
printf("Enter second no.\n");
scanf("%d",&b);
c=a+b;
printf("\n Sum= %d",c);
getch();
}

P3.
#include <stdio.h>
#include <conio.h>
void main()
{
int a,b,c;
printf("Enter First no.\n");
scanf("%d",&a);
printf("Enter second no.\n");
scanf("%d",&b);
c=a-b;

printf("\n Difference= %d",c);
getch();
}

P4.
#include <stdio.h>
#include <conio.h>
void main()
{
int a,b,c;
printf("Enter First no.\n");
scanf("%d",&a);
printf("Enter second no.\n");
scanf("%d",&b);
c=a*b;

printf("\n Product= %d",c);
getch();
}

P5.
#include <stdio.h>
#include <conio.h>
void main()
{
int a,b,c;
printf("Enter First no.\n");
scanf("%d",&a);
printf("Enter second no.\n");
scanf("%d",&b);
c=(int)(a/b);

printf("\n Quotient= %d",c);
getch();
}

P6.
#include <stdio.h>
#include <conio.h>
void main()
{
int a,b,c;
printf("Enter First no.\n");
scanf("%d",&a);
printf("Enter second no.\n");
scanf("%d",&b);
c=a%b;

printf("\n Modulus= %d",c);
getch();
}



P7.
#include <stdio.h>
#include <conio.h>
void main()
{
char x;
printf("Enter your gender\n");
x=getchar();
printf("\n\n Gender = ");
putchar(x);
getch();
}

P8. (Also given under the head "A little more of 'C'")
#include <stdio.h>
#include <conio.h>
void main()
{ char a, int p;
printf("Press 1 to convert from lower to upper OR 2 to convert from upper to lower\n");
scanf("%d",&p);
switch(p)
{case 1: printf("Enter any lowercase character\n");
a=getchar();
if(a<=122&&a>=97)
{a-=32;
putchar(a);}
else
printf("Entered character is not a lowercase character\n");
break;
case 2: printf("Enter any uppercase character\n");
a=getchar();
if(a<=90&&a>=65)
{a+=32;
putchar(a);}
else
printf("Entered character is not an uppercase character\n");
break;
default: printf("Entered choice is wrong\n");
}
getch();
}


2 comments:

  1. I’m not that much of a internet reader to be honest but your blogs really nice, keep it up!
    I'll go ahead and bookmark your website to come back down the road. Cheers
    Here is my web page : 301blackfriday.com

    ReplyDelete
  2. I’m a lengthy time watcher and I just believed I’d
    drop by and say howdy there for your very
    very first time.
    I severely get pleasure from your posts. Many thanks
    You will be my function models. Thanks for the write-up
    My web site :: how to get fair skin in 1 week

    ReplyDelete