עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

כתוב תוכנית ב- C שתקלוט מספר תלת סיפרתי ותדפיס את סיפרת העשרות.

Featured Replies

פורסם

אבל אני רוצה לכתוב אותה ע"י משתנה אחד (ע"י שימוש בפקודות בסיסיות). האם זה אפשרי?

אסביר:

כתבתי על ידי 2 משתנים

a

s

#include <iostream>

using namespace std;

int main ()

{

int a;

int s;

cout<<"Give me a tri-number:";

cin>>a;

a=a/10;

s=a%10;

cout<<"The answer is:"<<s <<endl;

return 0;

}

פורסם

אבל אני רוצה לכתוב אותה ע"י משתנה אחד  (ע"י שימוש בפקודות בסיסיות). האם זה אפשרי?

אסביר:

כתבתי על ידי 2 משתנים

a

s

#include <iostream>

using namespace std;

int main ()

{

int a;

int s;

cout<<"Give me a tri-number:";

cin>>a;

a=a/10;

s=a%10;

cout<<"The answer is:"<<s <<endl;

return 0;

}

אממ לא כל כך הבנתי מה עשית, אני מתחיל קצת, מתחילת השנה :) ועשיתי ככה עם משתנה אחד:

אם לא הבנת משהו תודיע ונסביר (אם ההסבר לא יהיה מובן .

  

#include<stdio.h>
#include<conio.h>
void main(void)
{
int num;
clrscr();
scanf("%d",&num); // קליטה של המספר תלת ספרתי
if(num/100==1);
{
num=num%100; // חילקתי את המספר התלת ספרתי ב 100 והשארתי את השארית ( % משאיר שארית)
num=num/10; // חילקתי את השארית ב10 והשארתי רק את השלם ללא השארית  (/ אינו משאיר את השארית, רק את השלם)
}
printf("%d",num); // הצגה של התוצאה על גבי המסך
}

מקווה שהבנת!  :-\

פורסם

printf("Ashrot:%d\n",num/10%10);

פורסם
  • מחבר

טעות שלי...סורי

למעשה , אני מתכוון האם אפשר לקצץ בשורה אחת מאלו:

cin>>a;

a=a/10;

s=a%10;

פורסם

טעות שלי...סורי

למעשה , אני מתכוון האם אפשר לקצץ בשורה אחת מאלו:

cin>>a;

a=a/10;

s=a%10;

MoRoses כבר ענה לך


cin>>a;
a=a/10%10

פורסם
  • מחבר

MoRoses כבר ענה לך


cin>>a;
a=a/10%10

אוי, נכון, לא שמתי לב..

תודה רבה על העזרה!!!! :xyxthumbs:

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.